【发布时间】:2018-08-22 10:53:01
【问题描述】:
我有一个使用 Visual Studio 2017 创建的 UWP 项目。它在这台机器(机器 1)上构建良好。
但是,当我将项目复制到仅安装了 Visual Studio 2017 构建工具的机器(机器 2)并尝试使用 MSBuild 构建它时,我收到以下错误:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets
(1126,5): error MSB3644: The reference assemblies for framework ".NETCore,Version=v5.0" were not found. To resolve this
, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framewo
rk for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assemb
ly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted
for the framework you intend. [<path_to_my_UWP_project>\UWP.csproj]
我怀疑我的 UWP.csproj 文件中的这一行需要 .NetCore v5.0:
我在机器 2 上构建之前进行了 nuget 还原,我可以看到 microsoft.netcore.universalwindowsplatform 在
然而,在机器 1 上,只有 microsoft.netcore.universalwindowsplatform 得到恢复,但它仍然可以通过 Visual Studio 正常构建。
问题:为什么会出现此错误?如何解决此问题?
【问题讨论】:
-
对我来说,将构建 UWP 应用程序所需的所有东西拼凑在一起是可行的或可能的并不是很明显。他们确实向不同的鼓手进军。讨论设置自动构建的专用 MSDN 页面is here。
-
所以您的建议是在 VSTS 上使用预配置的 UWP 构建步骤?
-
当您使用文档化的程序时,您会更容易找到帮助。假设你需要任何东西,期望是你不需要。
-
也许(虽然不相信它不会出现自己的一系列问题)。但我更喜欢使用我自己的自定义构建步骤,因为预配置的步骤为我提供了大约 1% 的所需功能。但让我感到惊讶的是,在三个移动平台(iOS、Android、UWP)上,MSBuild 努力构建您期望最简单的一个......考虑到它们都来自同一家公司。
标签: c# visual-studio msbuild .net-core