2017-02-07 21 views
1

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

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

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

以下是完整的控制台输出:

GetInstalledSDKLocations: 搜索软件开发工具包针对 “UAP,10.0.14393.0”。 正在搜索以“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”。 添加文件“Redist \ CommonConfiguration \ neutral \ Microsoft.VisualStudio.TestPlatform.ObjectModel。dll“,目标路径为”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):error:你的project.json没有列出'win10'作为目标运行时,你应该添加'“win10”:{ }'在你的project.json中的“运行时间”部分,然后 然后重新运行NuGet恢复。

这里是项目的project.json(它们两者目前是相同的,已将核心的所有依赖性添加到单元测试项目中)

{ 
    "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": {} 
    } 
} 
+0

为什么从命令行构建?他们是否都是VS? –

+0

他们都在VS.我需要为此设置一个Jenkins工作。所以我想首先运行单元测试项目,如果成功,詹金斯应该开始完整的工作。 –

+0

您可否请包括两个JSON项目文件的内容 –

回答