Xamarin.Build.Download Error - xamarin.android

I just updated the packages of nuget and, I m getting this error in my application even though i have Xamarin.Build.Download 0.4.11.
It says the missing file in packages is Xamarin.Build.Download 0.4.7.
The only solution i found was to downgrade the version of this.
Are there any other solutions that helps me work on 0.4.11?
Severity Code Description Project File Line Suppression State Error
This project references NuGet package(s) that are missing on this
computer. Use NuGet Package Restore to download them. For more
information, see http://go.microsoft.com/fwlink/?LinkID=322105. The
missing file is
..\packages\Xamarin.Build.Download.0.4.7\build\Xamarin.Build.Download.props. RoutineApp C:\some path
Studio 2017\some app 411

Related

Jenkins - Run a NuGet package restore to generate this file

When I build .NET Standard 2.0 Library on Jenkins build server
C:\Program Files\dotnet\sdk\2.1.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error : Assets file 'C:\Jenkins\workspace\<Project>\Sources\Library\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\Jenkins\workspace\<Project>\Sources\Library\Library.csproj]
I got an error above in build log.
I searched about error and I found solution
However, when running:
dotnet restore <Solution Name>
the solution does not help me out when I clean my workspace before build starts.
Therefore, I insert command before MSBuild but I failed with
C:\Program Files\dotnet\sdk\2.1.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error : Package Microsoft.CodeAnalysis.CSharp.Workspaces, version 2.8.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [C:\Jenkins\workspace\<Project>\Sources\Web\Web.csproj]
According to Solution reference, maybe upgrade Nuget Package Installer could help me out. But I do not know how can I upgrade Nuget Package Installer by command line...
I had the same problem, getting the same error:
error : Package <package> was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. [<path>]
I was able to solve it using MSBuild /t:restore instead of dotnet restore.
See: https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target
UPDATE: It's worth mentioning that problems in Jenkins are discussed in depth in this other answer.
The hint by #Mat didn't work for me: the /t:restore is currently not able to restore nuget packages for projects using package.config, as I mention here. What worked for me is the following:
call "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
nuget restore CodeBinder.sln
MSBuild Solution.sln /p:Configuration=Release /p:Platform="Any CPU" /t:build /restore
pause
It basically requires to download the nuget CLI from official site[1], Windows x86 Commandline section. The switch /restore , as pointed here, fixed the partially completed Nuget restore error, similarly to MSBuild /t:restore, but it can be done in conjunction with /t:build.
[1] https://www.nuget.org/downloads

NuGet Package restore failed for project PROJECT: Unable to find version 2.0.0 of package 'Microsoft.Net.Compilers'

I used the GitHub extension of Visual Studio 2015 to clone my project onto a new computer. I try to restore packages and I get an error that says:
NuGet Package restore failed for project PROJECT: Unable to find version 2.0.0 of package 'Microsoft.Net.Compilers'
I've looked into some other questions about similar issues, but none of those solutions have worked for me yet.
I tried deleting the packages folder, opening up up Visual Studios again and then rebuilding. That didn't resolve it.
I tried manually installing Microsoft.Net.Compilers in Package Manager Console.
PM> Install-Package Microsoft.Net.Compilers
I tried removing this bit of code from the csproj file (this seemed to work for some):
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
I tried reinstalling all packages with
Update-Package –reinstall
So far I haven't had any luck resolving the issue. Any help is appreciated.
EDIT:
I tried the response below and received this error:
Install-Package : Some NuGet packages are missing from the solution. The packages need to be restored in order to build the dependency graph. Restore the packages before performing any operations.
At line:1 char:16
+ Install-Package <<<< -Id Microsoft.Net.Compilers -Version 1.3.2 -Source nuget.org
+ CategoryInfo : InvalidOperation: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetMissingPackages,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
It also prompted me to restore packages. When I hit restore, I got the same error as usual.
Based on your error message looks like you are looking for a version that no longer exists and cannot tell which Package source you have selected. I feel like you are looking for version 2.0.0 which is not available in nuget.org repository. The latest one is 2.0.0-rc and it is pre release candidate.
Please try this command if you want to get the latest version
Install-Package -Id Microsoft.Net.Compilers -Version 2.0.0-rc -Source nuget.org
If you want the latest stable version (1.3.2), try this command
Install-Package -Id Microsoft.Net.Compilers -Version 1.3.2 -Source nuget.org
UPDATE
If the package still cannot be installed, then that package may be out of sync between packages.config, packages/ folder and .csproj file
Please follow these steps to perform manual cleanup
Close visual studio.
Open .csproj in a notepad or some text editor and manually remove all entries related to Microsoft.Net.Compilers
Open packages.config in a notepad or some text editor and and remove entry for the Microsoft.Net.Compilers package
Go to packages/ folder in windows explorer and delete the Microsoft.Net.Compilers folder
Now start the visual studio and open the solution.
Now try to install the package again.
Some of the entries that you may have to remove from .csproj as part of step 2 are these
<Import Project="..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props')" />
<NuGetPackageImportStamp></NuGetPackageImportStamp>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props'))" />
</Target>
I had a similar error after a clean install of Visual Studio 2017 and had to do the following to get it to automatically restore missing NuGet packages successfully. In VS, go to "Tools > Options > NuGet Package Manager > Package Sources", and ensure the appropriate package sources show and are checked.
See below. The addition of the nuget.org package source at the top tells VS to go online to download the packages from NuGet if it can’t find the appropriate versions on the local machine.
I also had similar problem on VS 2019, this one worked for me, just go to Tools > Options > NuGet Package Manager > General and Clear all NuGet Cache.
See the image below
This might be a bit late but it will still help somebody. When you try to check in your code and you get this kind of an error, it means that you had the package installed and uninstalled it again, so you just need to locate the package under included changes, in my example i an using TFS, and exclude or undo. this will solve the issue.
I moved my project in relation to where the NuGet packages had originally been stored in my project, and I eventually discovered that this causes a problem with that .csproj file that might not be immediately obvious.
Following the move and after doing a NuGet Package Restore, a second entry had been added to the EnsureNuGetPackageBuildImports target of my .csproj file reflecting the relative path of the new location.
The target now looked like the following:
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.2.10.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Net.Compilers.2.10.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Net.Compilers.2.10.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Net.Compilers.2.10.0\build\Microsoft.Net.Compilers.props'))" />
</Target>
Notice the two entries, with different paths to where the packages were located. This meant one of them (the first one, which was from before I moved the project) would always fail.
The fix was simple enough. I just removed the first Error node from the Target.
I also found that there was a similar problem in the initial Import nodes of the root Project node.
I had the following:
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Microsoft.Net.Compilers.2.10.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\..\packages\Microsoft.Net.Compilers.2.10.0\build\Microsoft.Net.Compilers.props')" />
<Import Project="..\packages\Microsoft.Net.Compilers.2.10.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.2.10.0\build\Microsoft.Net.Compilers.props')" />
Again, the fix was just to remove the erroneous Import node.
This kind of error can happen also using an old version of nuget.exe. For example, if you download the agent.zip of TFS 2015, inside it has version 3.2.1:
\Agent\Worker\Tools\nuget.exe
That version can give the error "Unable to find version '3.7.1' of package 'NUnit'." with a solution created with VS 2015. (NUnit3TestAdapter.3.9.0 doesn't give error, though)
Updating nuget.exe to 5.2 solves the problem.
I know why, it's in the C: \ Program Files (x86) \ Microsoft SDKs \ NuGetPackages folder. There are packages that you have installed before.
This was my error: "The project references NuGet packages that are missing on this computer. Use NuGet Package Restore to download them."
And this was my solution: I had to make sure that my Package Sources were checked in the Manage Nuget Packages window.
go to tools in navbar and tools and features and chek your freamworks are downloaded or not
enter image description here

Build failure - Restore package option not working in Visual Studio Team Services (was VS Online)

I am using a TFS Git project in Team Services and while my project compiles locally, I get a build failure when I check in my code to VS online and manually queue the build.
The errors at the moment are only pertaining to enterprise library data access dlls. I am using V6 of the library and this is error I get
The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
In my build definition I have checked the box against both Restore Nuget Packages and when that alone did not work, I checked the box against [Clean] as well. I still get that error. My packages.config files are checked in for each of the projects in the solution. I also have the Packages folder checked in but this folder has no dlls. It only has the various .nupkg files and respective .xml files checked in. Is this causing the problem?
Yes, you have to either checkin the DLLs or delete the nupkg files. The build server thinks you already have the packages so its not trying to restore them but the DLLs aren't there to reference.

TFS204018 error when installing NuGet Package in VS2015

Whenever I install a NuGet package in a TFS source-controlled VS 2015 project, I get a message similar to the following output under "Source Control - Team Foundation":
TF204018: Could not check the file's encoding because the file C:\TFS\Oz.Interfaces\Main\Source\MVRSTamperCodes\MVRSTamperCodes.Web\web.config is in use.
I've been searching fruitlessly to see if there's a way to fix this issue and haven't found anything yet. Does anyone know what is causing this message and/or what steps I can take to fix it? I should note that this doesn't prevent the successful installation of the NuGet package so it appears to just be a warning or informational message.
I've met similar issue with blocking web.config and other files. My solution was:
Uninstall NuGet Package Manager (Tools -> Extensions and Updates)
Install newest version (currently: Nuget 3.2)
If you're using Team Foundation Server, you will need to first check out the entire project, before updating Nuget Packages for the project, if you have this problem.

Referenced Dll's not found in Team Foundation Service (or: nuget packages not available on other pc)

when I create a build for the Team Foundation Service, I get all kind of reference dll's not found exceptions.
These references are added by nugget packages.
I've added the 'package restore' option on the solution which added 3 files in a .NuGet folder.
EDIT
When i got the solution from TFS on another pc, i got the same errors (missing dll's), so it's not only the TFS build service having problems.
The missing dll's are are missing files from installed nuget packages (some are part of the default VS template, Unity was a package i added later), which (the packages) are added on the first pc, but then are missing on the next pc (that's why i added the 'or' in the title of this question)
How can i get the Nuget added files on pc2 too?
I guess you've found a solution by now. I write this just to provide an answer for this question.
To have NuGet packages automatically downloaded on another PC, you need to enable NuGet package restore on build. You do this in two steps:
Right click the solution and select Enable NuGet Package Restore.
This will add a .nuget solution folder with NuGet.Config, NuGet.exe and NuGet.targets underneath it. These files should actually be checked in to source control, but the binary file is tiny. It will also modify the MSBuild scripts in all projects of the solution to import the NuGet.targets file to hook NuGet into the build process.
In Tools -> Library Package Manager -> Package Manager Settings make sure the option 'Allow NuGet to download missing packages during build' is checked.
This step must be done on all machines.
Now the BuildDependsOn property of all project build scripts should make the RestorePackages target in NuGet.targets kick in and download missing packages before you get build errors for missing references.

Resources