Reputation: 175
I'm trying to create an android application using Xamarin and Visual Studio 2015 with another friend with source control.
Everything went fine until my friend added a project and he used NuGet packages.
After I activated the get latest version and tried to build the solution I got the error message:
Severity Code Description Project File Line
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\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props. iBuy.API C:\Users\איציק\Source\Workspaces\iBuy\IBuy\iBuy.API\iBuy.API.csproj 164
I looked up some solutions for this problem and tried to uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers packages and re installing them but it didn't help. I don't even have a \packages\Microsoft.Net.Compilers.1.0.0\build folder in my solution.
Everything in the NuGet package restore is already checked and I don't have any '.nuget' files in my solution.
What can I do to eliminate that error message?
Thank you in advance!
Upvotes: 7
Views: 8773
Reputation: 47917
That error message will be occurring because you do not have the .nuget\NuGet.targets file.
To fix it you could stop using the MSBuild based NuGet package restore or add the .nuget/NuGet.targets file to source control.
The MSBuild based NuGet package restore is deprecated by the NuGet team. It adds some extra elements to your project file (.csproj):
<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>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
You may have more items in the EnsureNuGetPackageBuildImports target element. You can remove these from the project file and instead rely on Visual Studio to restore the NuGet packages.
Upvotes: 13