[英]Restoring dependency via nuget in VS2017
我使用VS2017创建了Windows Runtime Component (Universal)
类型的项目。 项目文件包括软件包参考:
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>5.2.3</Version>
</PackageReference>
</ItemGroup>
如果启用了此选项,则一切工作正常: Automatically check for missing packages during build in Visual Studio
但是在某些情况下(禁用此选项,通过CLI进行构建,通过服务器CI构建),但是在构建期间未自动恢复此依赖关系,并且在构建后obj
文件夹中缺少project.assets.json
。 它会导致很多类似这样的错误: error CS0518: Predefined type 'System.String' is not defined or imported
是否可以通过项目文件(.csproj)自动恢复包引用?
谢谢
在生成解决方案以还原所有软件包之前,请执行msbuild -t:restore your.sln
,并确保您的CI使用MSBuild15.x。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.