MSBuildSdkExtras icon indicating copy to clipboard operation
MSBuildSdkExtras copied to clipboard

The publish target fails for uap10.0

Open ryantrem opened this issue 7 years ago • 6 comments

When a project includes the uap10.0 target framework, msbuild /t:publish fails with:

C:\Program Files\dotnet\sdk\2.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(280,5): error NETSDK1005: Assets file 'C:\Temp\MSBuildSDKExtrasTest\obj\project.assets.json' doesn't have a target for '.NETCore,Version=v5.0'. Ensure that restore has run and that you have included 'netcore50' in the TargetFrameworks for your project.

ryantrem avatar Nov 06 '18 04:11 ryantrem

Did you run restore first? Either as msbuild /t:restore or in one command msbuild /restore /t:publish

clairernovotny avatar Nov 06 '18 04:11 clairernovotny

Yes, I ran restore first.

ryantrem avatar Nov 06 '18 04:11 ryantrem

do you have a simple repro that you can share?

clairernovotny avatar Nov 06 '18 04:11 clairernovotny

Default .NET Standard project with MSBuild.Sdk.Extras and uap10.0 added to <TargetFrameworks>:

<Project Sdk="MSBuild.Sdk.Extras/1.6.61">
  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;uap10.0</TargetFrameworks>
  </PropertyGroup>
</Project>

Then just do msbuild /t:restore;publish

ryantrem avatar Nov 06 '18 05:11 ryantrem

unfortunately publish and restore targets cannot be combined in the same line like that. You either need to call msbuild /t:restore first, or use the /restore switch instead like msbuild /restore /t:publish.

clairernovotny avatar Nov 06 '18 12:11 clairernovotny

I've tried all the combinations of doing a restore first, then a publish, but I always get this error. This only happens for uap10.0.

ryantrem avatar Nov 06 '18 16:11 ryantrem