MSBuildSdkExtras icon indicating copy to clipboard operation
MSBuildSdkExtras copied to clipboard

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

Open bgavrilMS opened this issue 4 years ago • 6 comments

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:

  • Add Microsoft.Identity.Client.dll to the monoandroid90 reference group in the nuspec
  • Add Microsoft.Identity.Client.xml to the monoandroid90 reference group in the nuspec
  • Add Microsoft.Identity.Client.dll to the net45 reference group in the nuspec
  • Add Microsoft.Identity.Client.xml to the net45 reference group in the nuspec
  • Add Microsoft.Identity.Client.dll to the netcoreapp2.1 reference group in the nuspec
  • Add Microsoft.Identity.Client.xml to the netcoreapp2.1 reference group in the nuspec
  • Add Microsoft.Identity.Client.dll to the netstandard1.3 reference group in the nuspec
  • Add Microsoft.Identity.Client.xml to the netstandard1.3 reference group in the nuspec
  • Add Microsoft.Identity.Client.dll to the uap10.0 reference group in the nuspec
  • Add Microsoft.Identity.Client.xml to the uap10.0 reference group in the nuspec
  • Add Microsoft.Identity.Client.dll to the xamarinios10 reference group in the nuspec
  • Add Microsoft.Identity.Client.xml to the xamarinios10 reference group in the nuspec
  • Add Microsoft.Identity.Client.dll to the xamarinmac20 reference group in the nuspec
  • Add Microsoft.Identity.Client.xml to the xamarinmac20 reference group in the nuspec

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 avatar Oct 10 '19 17:10 bgavrilMS

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

bgavrilMS avatar Oct 16 '19 17:10 bgavrilMS

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?

clairernovotny avatar Oct 16 '19 17:10 clairernovotny

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.

bgavrilMS avatar Oct 16 '19 21:10 bgavrilMS

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.

clairernovotny avatar Dec 16 '19 14:12 clairernovotny

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

bgavrilMS avatar Dec 16 '19 16:12 bgavrilMS

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

DRAirey1 avatar Jan 03 '20 12:01 DRAirey1