2015-09-19 84 views
6

我想創建一個使用Xamarin和Visual Studio 2015與另一個朋友與源代碼管理的Android應用程序。NuGet包在視覺工作室2015和Xamarin導致麻煩

一切都很好,直到我的朋友添加了一個項目,他使用NuGet包。

後,我啓動了獲得最新版本,並嘗試建立我得到的錯誤信息解決方案:

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 

我擡頭對這個問題的一些解決方案,並試圖卸載Microsoft.CodeDom.Providers.DotNetCompilerPlatform和Microsoft.Net.Compilers打包並重新安裝它們,但它沒有幫助。 我的解決方案中甚至沒有\ packages \ Microsoft.Net.Compilers.1.0.0 \ build文件夾。

NuGet包恢復中的所有內容都已經過檢查,我的解決方案中沒有任何'.nuget'文件。

我能做些什麼來消除錯誤信息?

預先感謝您!

回答

12

由於您沒有.nuget \ NuGet.targets文件,將會發生此錯誤消息。

要修復它,您可以停止使用基於MSBuild的NuGet軟件包恢復,或將.nuget/NuGet.targets文件添加到源代碼控制。

NuGet團隊不推薦使用基於MSBuild的NuGet包恢復。它增加了一些額外的元素,你的項目文件(.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')" /> 

您可能必須在EnsureNuGetPackageBuildImports目標元素更多的項目。您可以從項目文件中刪除這些文件,而是依靠Visual Studio來恢復NuGet包。

+0

作品!謝謝 – nosensus

+0

擁抱和親吻給你。 – bonitzenator