NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 253 forks source link

Incorrect NU5131 error with MSAL #8943

Open clairernovotny opened 4 years ago

clairernovotny commented 4 years ago

Please read the following information before posting the issue.

Details about Problem

msbuild /t:pack

dotnet.exe --version (if appropriate): 3.1.100

VS version (if appropriate): VS 16.5

Worked before? If so, with which NuGet version: dotnet sdk 2.2

Detailed repro steps so we can see the same problem

It appears that the validation rule added in https://github.com/NuGet/Home/issues/8296 isn't correctly validating packages created by the SDK Extras. We see

C:\Program Files\dotnet\sdk\3.1.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
 [D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\Microsoft.Identity.Client.csproj]

Coming from PackTask, but when we look at the generated nupkg, it appears to be correct. Thus the validation rule is failing and causing the build to fail.

This is captured here: https://github.com/novotnyllc/MSBuildSdkExtras/issues/191

Repro:

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

/cc @bgavrilMS

clairernovotny commented 4 years ago

Here's the nuspec generated by the pack task:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
  <metadata>
    <id>Microsoft.Identity.Client</id>
    <version>4.4.0-localbuild</version>
    <title>Microsoft Authentication Library for .NET</title>
    <authors>Microsoft</authors>
    <owners>Microsoft</owners>
    <requireLicenseAcceptance>true</requireLicenseAcceptance>
    <license type="expression">MIT</license>
    <licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
    <projectUrl>https://go.microsoft.com/fwlink/?linkid=844761</projectUrl>
    <description>This package contains the binaries of the Microsoft Authentication Library for .NET (MSAL.NET).
      MSAL.NET makes it easy to obtain tokens from the Microsoft identity platform for developers (formally Azure AD v2.0) signing-in users with work &amp; school accounts, Microsoft personal accounts and social identities Azure AD B2C. These tokens again access to Microsoft Cloud API and any other API secured by the Microsoft identity platform. This version supports adding authentication functionality to your .NET based client on Windows desktop (.NET 4.5+), UWP, .NET Core, Xamarin iOS and Xamarin Android.</description>
    <releaseNotes>The changelog is available at https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/master/changelog.txt and the roadmap at https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki#roadmap</releaseNotes>
    <copyright>© Microsoft Corporation. All rights reserved.</copyright>
    <tags>Microsoft Authentication Library MSA MSAL B2C Azure Active Directory AAD Identity Authentication .NET Windows Store Xamarin iOS Android</tags>
    <repository type="git" url="https://github.com/AzureAD/microsoft-authentication-library-for-dotnet" commit="4a58082faec3874783abb2e0b12c2834e142d422" />
    <dependencies>
      <group targetFramework=".NETFramework4.5" />
      <group targetFramework=".NETStandard1.3">
        <dependency id="Microsoft.CSharp" version="4.5.0" exclude="Build,Analyzers" />
        <dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" />
        <dependency id="System.ComponentModel.TypeConverter" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Diagnostics.Process" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Dynamic.Runtime" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Private.Uri" version="4.3.2" exclude="Build,Analyzers" />
        <dependency id="System.Runtime.Serialization.Formatters" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Runtime.Serialization.Json" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Security.Cryptography.X509Certificates" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Security.SecureString" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Xml.XDocument" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Xml.XmlDocument" version="4.3.0" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="MonoAndroid9.0">
        <dependency id="System.Security.SecureString" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="Xamarin.Android.Support.CustomTabs" version="28.0.0.1" exclude="Build,Analyzers" />
        <dependency id="Xamarin.Android.Support.v7.AppCompat" version="28.0.0.1" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="UAP10.0">
        <dependency id="Microsoft.CSharp" version="4.5.0" exclude="Build,Analyzers" />
        <dependency id="System.Net.NameResolution" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Runtime.Serialization.Formatters" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Runtime.Serialization.Json" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Security.SecureString" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.ServiceModel.Http" version="4.5.3" exclude="Build,Analyzers" />
        <dependency id="System.ServiceModel.NetTcp" version="4.5.3" exclude="Build,Analyzers" />
        <dependency id="System.ServiceModel.Security" version="4.5.3" exclude="Build,Analyzers" />
        <dependency id="System.Xml.XDocument" version="4.3.0" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="Xamarin.iOS1.0">
        <dependency id="Microsoft.CSharp" version="4.5.0" exclude="Build,Analyzers" />
        <dependency id="System.ComponentModel.TypeConverter" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Runtime.Serialization.Formatters" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Security.SecureString" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Xml.XmlDocument" version="4.3.0" exclude="Build,Analyzers" />
      </group>
      <group targetFramework="Xamarin.Mac2.0" />
      <group targetFramework=".NETCoreApp2.1">
        <dependency id="Microsoft.CSharp" version="4.5.0" exclude="Build,Analyzers" />
        <dependency id="System.ComponentModel.TypeConverter" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Net.NameResolution" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Private.Uri" version="4.3.2" exclude="Build,Analyzers" />
        <dependency id="System.Runtime.Serialization.Formatters" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Runtime.Serialization.Json" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Security.SecureString" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Xml.XDocument" version="4.3.0" exclude="Build,Analyzers" />
      </group>
    </dependencies>
    <frameworkAssemblies>
      <frameworkAssembly assemblyName="Java.Interop" targetFramework="MonoAndroid9.0" />
      <frameworkAssembly assemblyName="Microsoft.CSharp" targetFramework="MonoAndroid9.0, .NETFramework4.5" />
      <frameworkAssembly assemblyName="System.Core" targetFramework="MonoAndroid9.0, .NETFramework4.5, Xamarin.iOS1.0, Xamarin.Mac2.0" />
      <frameworkAssembly assemblyName="System" targetFramework="MonoAndroid9.0, .NETFramework4.5, Xamarin.iOS1.0, Xamarin.Mac2.0" />
      <frameworkAssembly assemblyName="System.IdentityModel" targetFramework="MonoAndroid9.0, .NETFramework4.5, Xamarin.iOS1.0, Xamarin.Mac2.0" />
      <frameworkAssembly assemblyName="System.Net.Http" targetFramework="MonoAndroid9.0, .NETFramework4.5, Xamarin.iOS1.0, Xamarin.Mac2.0" />
      <frameworkAssembly assemblyName="System.Runtime.Serialization" targetFramework="MonoAndroid9.0, Xamarin.iOS1.0, Xamarin.Mac2.0" />
      <frameworkAssembly assemblyName="System.Xml" targetFramework="MonoAndroid9.0, .NETFramework4.5, Xamarin.iOS1.0, Xamarin.Mac2.0" />
      <frameworkAssembly assemblyName="System.Xml.Linq" targetFramework="MonoAndroid9.0, .NETFramework4.5, Xamarin.iOS1.0, Xamarin.Mac2.0" />
      <frameworkAssembly assemblyName="System.Data.DataSetExtensions" targetFramework=".NETFramework4.5" />
      <frameworkAssembly assemblyName="System.Data" targetFramework=".NETFramework4.5" />
      <frameworkAssembly assemblyName="System.Drawing" targetFramework=".NETFramework4.5" />
      <frameworkAssembly assemblyName="System.Windows.Forms" targetFramework=".NETFramework4.5" />
      <frameworkAssembly assemblyName="System.Drawing.Common.dll" targetFramework="Xamarin.iOS1.0, Xamarin.Mac2.0" />
      <frameworkAssembly assemblyName="Xamarin.Mac" targetFramework="Xamarin.Mac2.0" />
    </frameworkAssemblies>
  </metadata>
  <files>
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\net45\Microsoft.Identity.Client.dll" target="lib\net45\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\net45\Microsoft.Identity.Client.xml" target="lib\net45\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\netstandard1.3\Microsoft.Identity.Client.dll" target="lib\netstandard1.3\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\netstandard1.3\Microsoft.Identity.Client.xml" target="lib\netstandard1.3\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\netcoreapp2.1\Microsoft.Identity.Client.dll" target="lib\netcoreapp2.1\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\netcoreapp2.1\Microsoft.Identity.Client.xml" target="lib\netcoreapp2.1\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\uap10.0\Microsoft.Identity.Client.dll" target="lib\uap10.0\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\uap10.0\Microsoft.Identity.Client.xml" target="lib\uap10.0\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\uap10.0\Microsoft.Identity.Client.pri" target="lib\uap10.0\Microsoft.Identity.Client.pri" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\xamarin.ios10\Microsoft.Identity.Client.dll" target="lib\xamarinios10\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\xamarin.ios10\Microsoft.Identity.Client.xml" target="lib\xamarinios10\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\monoandroid9.0\Microsoft.Identity.Client.dll" target="lib\monoandroid90\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\monoandroid9.0\Microsoft.Identity.Client.xml" target="lib\monoandroid90\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\xamarinmac20\Microsoft.Identity.Client.dll" target="lib\xamarinmac20\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\bin\Debug\xamarinmac20\Microsoft.Identity.Client.xml" target="lib\xamarinmac20\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\monoandroid9.0\ref\Microsoft.Identity.Client.dll" target="ref\MonoAndroid9.0\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\monoandroid9.0\Microsoft.Identity.Client.xml" target="ref\MonoAndroid9.0\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\net45\ref\Microsoft.Identity.Client.dll" target="ref\net45\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\net45\Microsoft.Identity.Client.xml" target="ref\net45\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\netcoreapp2.1\ref\Microsoft.Identity.Client.dll" target="ref\netcoreapp2.1\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\netcoreapp2.1\Microsoft.Identity.Client.xml" target="ref\netcoreapp2.1\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\netstandard1.3\ref\Microsoft.Identity.Client.dll" target="ref\netstandard1.3\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\netstandard1.3\Microsoft.Identity.Client.xml" target="ref\netstandard1.3\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\uap10.0\ref\Microsoft.Identity.Client.dll" target="ref\uap10.0\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\uap10.0\Microsoft.Identity.Client.xml" target="ref\uap10.0\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\xamarin.ios10\ref\Microsoft.Identity.Client.dll" target="ref\Xamarin.iOS10\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\xamarin.ios10\Microsoft.Identity.Client.xml" target="ref\Xamarin.iOS10\Microsoft.Identity.Client.xml" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\xamarinmac20\ref\Microsoft.Identity.Client.dll" target="ref\xamarinmac20\Microsoft.Identity.Client.dll" />
    <file src="D:\dev\microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Ref\obj\Debug\xamarinmac20\Microsoft.Identity.Client.xml" target="ref\xamarinmac20\Microsoft.Identity.Client.xml" />
  </files>
</package>
clairernovotny commented 4 years ago

If there's a update to the nuspec requirements that mandates generation of reference items for each TFM, then the PackTask doesn't appear to be doing that correctly in this case or doesn't have the right inputs to determine how to generate those elements. Either way, there's a gap here.