首页 文章

MSBuild在UWP项目上失败

提问于
浏览
1

我在我的解决方案中有两个项目,MyProject.Core和MyProject.UnitTests,它们都是UWP . 从VS我可以构建并运行它们没有问题,但是当我尝试从命令行构建UnitTests项目时,使用MSBUILD.exe我收到此错误:

C:\ Program File x86)\ MSBuild \ Microsoft \ NuGet \ Microsoft.NuGet.targets(140,5):错误:您的project.json没有将'win10'列为目标运行时 . 你应该在你的project.json中的“runtimes”部分添加'“win10”:{}',然后重新运行NuGet恢复

这个错误完全是误导 . 我注意到当我删除对Core项目的引用时,它确实有效 . 我认为它与Core项目的引用有关 . 我试过手动添加它们,但没有运气 .

这是完整的控制台输出:

GetInstalledSDKLocations:搜索面向“UAP,10.0.14393.0”的SDK . 正在搜索针对“Windows,8.1”的SDK . ResolveSDKReferences:读取SDK清单文件“C:\ Program Files(x86)\ Microsoft SDKs \ Windows Kits \ 10 \ ExtensionSDKs \ MSTestFramework.Universal \ 14.0 \ SDKManifest.xml” . 目标配置和体系结构“Retail | x86”SDK清单中未找到FrameworkIdentity属性,将此SDK视为非框架SDK . SDK清单中未找到指示应用程序包位置的“APPX”属性 . 如果在运行时需要应用程序包,则项目可能无法运行 . 读取SDK清单文件“C:\ Program Files(x86)\ Microsoft SDKs \ Windows Kits \ 10 \ ExtensionSDKs \ TestPlatform.Universal \ 14.0 \ SDKManifest.xml” . 目标配置和体系结构“Retail | x86”SDK清单中未找到FrameworkIdentity属性,将此SDK视为非框架SDK . SDK清单中未找到指示应用程序包位置的“APPX”属性 . 如果在运行时需要应用程序包,则项目可能无法运行 . ExpandSDKReferences:从“C:\ Program Files(x86)\ Microsoft SDKs \ Windows Kits \ 10 \ ExtensionSDKs \ MSTestFramework.Universal \ 14.0 \”枚举SDK参考“MSTestFramework.Universal,Version = 14.0” . 添加引用“References \ CommonConfiguration \ neutral \ Microsoft.VisualStudio.TestPlatform.UnitTestFramework.AppContainer.dll” . 添加引用“References \ CommonConfiguration \ neutral \ Microsoft.VisualStudio.TestPlatform.UnitTestFramework.dll” . 使用目标路径“Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter.dll”从redist文件夹添加文件“Redist \ CommonConfiguration \ neutral \ Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter.dll” . 从“C:\ Program Files(x86)\ Microsoft SDKs \ Windows Kits \ 10 \ ExtensionSDKs \ TestPlatform.Universal \ 14.0 \”枚举SDK参考“TestPlatform.Universal,Version = 14.0” . 添加引用“References \ CommonConfiguration \ neutral \ Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll” . 使用目标路径“vstest.executionengine.WindowsPhone.dll”从redist文件夹添加文件“Redist \ CommonConfiguration \ x86 \ vstest.executionengine.WindowsPhone.dll” . 使用目标路径“vstest_executionengine_platformbridge.dll”从redist文件夹添加文件“Redist \ CommonConfiguration \ x86 \ vstest_executionengine_platformbridge.dll” . 使用目标路径“Microsoft.VisualStudio.TestPlatform.Common.dll”从redist文件夹添加文件“Redist \ CommonConfiguration \ neutral \ Microsoft.VisualStudio.TestPlatform.Common.dll” . 使用目标路径“Microsoft.VisualStudio.TestPlatform.Core.dll”从redist文件夹添加文件“Redist \ CommonConfiguration \ neutral \ Microsoft.VisualStudio.TestPlatform.Core.dll” . 使用目标路径“Microsoft.VisualStudio.TestPlatform.ObjectModel.dll”从redist文件夹添加文件“Redist \ CommonConfiguration \ neutral \ Microsoft.VisualStudio.TestPlatform.ObjectModel.dll” . 从redist文件夹添加文件“Redist \ CommonConfiguration \ neutral \ vstest_executionengine_platformbridge.winmd”,目标路径为“vstest_executionengine_platformbridge.winmd” . C:\ Program Files(x86)\ MSBuild \ Microsoft \ NuGet \ Microsoft.NuGet.targets(140,5):错误:您的project.json未将“win10”列为目标运行时 . 您应该在project.json的“runtimes”部分中添加“win10”:{}',然后重新运行NuGet恢复 .

这是项目的project.json(目前它们都是相同的,因为我已经将Core的所有依赖项添加到单元测试项目中)

{
  "dependencies": {
    "CommonServiceLocator": "1.3.0",
    "HockeySDK.UWP": "4.1.6",
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",
    "Microsoft.Xaml.Behaviors.Uwp.Managed": "2.0.0",
    "MvvmLight": "5.3.0",
    "MvvmLightLibs": "5.3.0",
    "Newtonsoft.Json": "9.0.1",
    "System.Reactive": "3.1.1"
  }, "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}

1 回答

相关问题