在堆栈上有一个类似的帖子,但它没有可能因为我使用的是Visual Studio 2015而对我的问题有所帮助.
There's a similar post on stack but it doesn't help with my issue possibly because I am using Visual Studio 2015.
如何使启用NuGet软件包还原"选项出现在VS2015中?
How do I get the "Enable NuGet Package Restore" option to appear in VS2015?
我选择了文件">新建项目",并创建了一个空的ASP.NET Web应用程序.我正在寻找此菜单选项.
I chose File > New Project and created an empty ASP.NET Web Application. I'm looking for this menu option.
我应该提到我已经在我的项目文件夹中寻找了任何先前存在的nuGet文件,但是没有.
I should mention that I have looked for any pre-existing nuGet files in my project folder and there are none.
推荐答案花费了很长时间,但我终于在,我能够使用此处介绍的方法解决此问题.
It took far too long but I finally found this document on Migrating MSBuild-Integrated solutions to Automatic Package Restore and I was able to resolve the issue using the methods described here.
在手动编辑文件时,将需要以下内容:
When editing your files by hand, here's what you'll be looking for:
解决方案文件(.sln)
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{F4AEBB8B-A367-424E-8B14-F611C9667A85}" ProjectSection(SolutionItems) = preProject .nuget\NuGet.Config = .nuget\NuGet.Config .nuget\NuGet.exe = .nuget\NuGet.exe .nuget\NuGet.targets = .nuget\NuGet.targets EndProjectSection EndProject项目文件(.csproj/.vbproj)
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <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 go.microsoft/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>更多推荐
如何在Visual Studio中启用NuGet程序包还原?
发布评论