novotnyllc / MSBuildSdkExtras

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

Library with reference assembly fails on /t:pack with netcore sdk 3 #191

Open bgavrilMS opened 5 years ago

bgavrilMS commented 5 years ago

MSAL, which uses the sdk extras, including reference assemblies, is built using VS 2019 Azure DevOps hosted image, which now contains .net core sdk 3.

This leads to the following error while performing msbuild /t:pack:

[error]C:\Program Files\dotnet\sdk\3.0.100\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(198,5): Error NU5131: References were found in the nuspec, but some reference assemblies were not found in both the nuspec and ref folder. Add the following reference assemblies:

I have no idea where to add this, since /t:pack generates a nuspec. Does msbuild.sdk.extras intervene in the creation of the nuspec ?

bgavrilMS commented 5 years ago

Please let me know if more info is needed on this.

Repro steps would be:

  1. clone https://github.com/AzureAD/microsoft-authentication-library-for-dotnet
  2. cd src\client\Microsoft.Identity.Client
  3. msbuild /t:pack
clairernovotny commented 5 years ago

I haven't had much time to look but it appears the targetframeworks list is the same for the ref and the libs. Why use the ref at that point? Put another way, what are you actively using the ref for?

bgavrilMS commented 5 years ago

We're using the bait and switch technique to model the public API in netstandard versus other tfms. There are quite a few places where we do this, and it has worked quite well so far - developers find the API intuitive and we've not seen any MethodMissingException reported.

The issue described only occurs with .net core 3, if I modify the global.json to use a 2.x .net core SDK, this does not occur.

clairernovotny commented 4 years ago

Not sure what's going on with the PackTask, but you can work around this by disabling the warning that's being turned into an error by adding NU5131 to the NoWarn list.

bgavrilMS commented 4 years ago

Thanks @onovotny , I'll give that a go and report back.

DRAirey1 commented 4 years ago

I'm running into the same issue. Either fix it, or give me some idea how to fix the nuspec so I can get rid the warning, please. ThetaRex.Forms.zip