novotnyllc / MSBuildSdkExtras

Extra properties for MSBuild SDK projects
MIT License
347 stars 42 forks source link

The publish target fails for uap10.0 #129

Open ryantrem opened 5 years ago

ryantrem commented 5 years ago

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.
clairernovotny commented 5 years ago

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

ryantrem commented 5 years ago

Yes, I ran restore first.

clairernovotny commented 5 years ago

do you have a simple repro that you can share?

ryantrem commented 5 years ago

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

clairernovotny commented 5 years ago

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.

ryantrem commented 5 years ago

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.