Titus Moldovan
Titus Moldovan

Reputation: 31

MSBuild fails on UWP project

I have in my solution two project, MyProject.Core and MyProject.UnitTests, both of them UWP. From VS I can build and run them with no problem, but when I try to build the UnitTests project from the command line, using MSBUILD.exe I get this error:

C:\Program File x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : Your project.json doesn't list 'win10' as a targeted runtime. You should add '"win10": { }' inside your "runtimes" section in your project.json, an d then re-run NuGet restore

The error is totally misleading. I've noticed that when I remove the reference to the Core project, it does work. I think it has something to do with the references of the Core project. I've tried adding them manually, but no luck.

Here is the full console output:

GetInstalledSDKLocations: Searching for SDKs targeting "UAP, 10.0.14393.0". Searching for SDKs targeting "Windows, 8.1". ResolveSDKReferences: Reading SDK manifest file "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\MSTestFramework.Universal\14.0\SDKManifest.xml". Targeted configuration and architecture "Retail|x86" No FrameworkIdentity attributes were found in the SDK manifest, treating this SDK as a non-framework SDK. No "APPX" attributes indicating app package locations were found in the SDK manifest. If an app package is required at runtime the project may not run. Reading SDK manifest file "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\TestPlatform.Universal\14.0\SDKManifest.xml". Targeted configuration and architecture "Retail|x86" No FrameworkIdentity attributes were found in the SDK manifest, treating this SDK as a non-framework SDK. No "APPX" attributes indicating app package locations were found in the SDK manifest. If an app package is required at runtime the project may not run. ExpandSDKReferences: Enumerating SDK Reference "MSTestFramework.Universal, Version=14.0" from "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\MSTestFramework.Universal\14.0\". Adding reference "References\CommonConfiguration\neutral\Microsoft.VisualStudio.TestPlatform.UnitTestFramework.AppContainer.dll". Adding reference "References\CommonConfiguration\neutral\Microsoft.VisualStudio.TestPlatform.UnitTestFramework.dll". Adding file "Redist\CommonConfiguration\neutral\Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter.dll" from redist folder with target path "Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter.dll". Enumerating SDK Reference "TestPlatform.Universal, Version=14.0" from "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\TestPlatform.Universal\14.0\". Adding reference "References\CommonConfiguration\neutral\Microsoft.VisualStudio.TestPlatform.TestExecutor.Core.dll". Adding file "Redist\CommonConfiguration\x86\vstest.executionengine.WindowsPhone.dll" from redist folder with target path "vstest.executionengine.WindowsPhone.dll". Adding file "Redist\CommonConfiguration\x86\vstest_executionengine_platformbridge.dll" from redist folder with target path "vstest_executionengine_platformbridge.dll". Adding file "Redist\CommonConfiguration\neutral\Microsoft.VisualStudio.TestPlatform.Common.dll" from redist folder with target path "Microsoft.VisualStudio.TestPlatform.Common.dll". Adding file "Redist\CommonConfiguration\neutral\Microsoft.VisualStudio.TestPlatform.Core.dll" from redist folder with target path "Microsoft.VisualStudio.TestPlatform.Core.dll". Adding file "Redist\CommonConfiguration\neutral\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll" from redist folder with target path "Microsoft.VisualStudio.TestPlatform.ObjectModel.dll". Adding file "Redist\CommonConfiguration\neutral\vstest_executionengine_platformbridge.winmd" from redist folder with target path "vstest_executionengine_platformbridge.winmd". C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : Your project.json doesn't list 'win10' as a targeted runtime. You should add '"win10": { }' inside your "runtimes" section in your project.json, and then re-run NuGet restore.

Here it is the project.json of the projects (both of them are identical at the moment, since I've added all the dependancies of the Core to the Unit Tests project)

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

Upvotes: 1

Views: 806

Answers (1)

Matt Lacey
Matt Lacey

Reputation: 65556

To recreate at the command line, a build that Visual Studio can do successfully, see the instructions at https://msdn.microsoft.com/en-us/library/jj651643.aspx to see the commands that VS uses.

Quick summary: Set Build output verbosity to 'Diagnostic'

Upvotes: 0

Related Questions