Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange build error when calling "pack" target #4337

Closed
JohnTortugo opened this issue Nov 12, 2019 · 18 comments
Closed

Strange build error when calling "pack" target #4337

JohnTortugo opened this issue Nov 12, 2019 · 18 comments
Assignees

Comments

@JohnTortugo
Copy link
Contributor

Reported by @AdamYoblick by e-mail:

We’re seeing a strange error in the winforms internal build. The errors don’t seem to cause the step to fail.

Sample build: https://dev.azure.com/dnceng/public/_build/results?buildId=424221&view=logs

.dotnet\sdk\5.0.100-alpha1-014915\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5128: Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below:
- Add lib or ref assemblies for the netcoreapp5.0 target framework
.dotnet\sdk\5.0.100-alpha1-014915\Sdks\NuGet.Build.Tasks.Pack\build\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 System.Drawing.dll to the netcoreapp5.0 reference group in the nuspec
- Add System.Design.dll to the netcoreapp5.0 reference group in the nuspec
- Add System.Drawing.Design.dll to the netcoreapp5.0 reference group in the nuspec
- Add System.Windows.Forms.dll to the netcoreapp5.0 reference group in the nuspec
- Add System.Windows.Forms.xml to the netcoreapp5.0 reference group in the nuspec
- Add System.Windows.Forms.Design.dll to the netcoreapp5.0 reference group in the nuspec
- Add System.Windows.Forms.Design.xml to the netcoreapp5.0 reference group in the nuspec
- Add System.Windows.Forms.Design.Editors.dll to the netcoreapp5.0 reference group in the nuspec
- Add System.Windows.Forms.Design.Editors.xml to the netcoreapp5.0 reference group in the nuspec
- Add Microsoft.VisualBasic.dll to the netcoreapp5.0 reference group in the nuspec
- Add Accessibility.dll to the netcoreapp5.0 reference group in the nuspec
- Add Accessibility.xml to the netcoreapp5.0 reference group in the nuspec

I don’t think we’ve made any changes to the package in over a month. Are you aware of anyone else seeing this?

@AdamYoblick
Copy link
Member

/cc @RussKie

@RussKie
Copy link
Member

RussKie commented Nov 12, 2019

The errors are reported in the public CI pipeline but the errors don't break builds.

The internal builds are actually failing because of these errors (e.g. https://dev.azure.com/dnceng/internal/_build/results?buildId=424371)

@JohnTortugo
Copy link
Contributor Author

Adding some folks from NuGet team who might shed some light here: @dtivel @nkolev92

@nkolev92
Copy link
Contributor

nkolev92 commented Nov 13, 2019

Those are warnings that are getting elevated to errors in the build likely.

https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5128
https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5131

The warnings are something that was added in 3.0.100, and ideally should be addressed.
They communicate authoring in packages that might not work in the exact way the author intended them to work.

I'd recommend you analyze the warnings, I'd be happy to chat through any issues if necessary.

fyi @zivkan

@AdamYoblick
Copy link
Member

AdamYoblick commented Nov 13, 2019

@nkolev92 Can we keep the chat in this issue just so it's documented, in case other teams run into this?

We have two csproj files that generated packages. They are both under https://github.com/dotnet/winforms/tree/master/pkg.

I looked at the warnings, but I'm not sure what actions to take here. The lib and ref folders inside the packages have not changed, and the nuspec is created for us by the -pack target.

The nuspec for one of the packages looks like this:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>Microsoft.Private.Winforms</id>
    <version>5.0.0-dev</version>
    <authors>Microsoft</authors>
    <owners>Microsoft</owners>
    <requireLicenseAcceptance>true</requireLicenseAcceptance>
    <license type="expression">MIT</license>
    <licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
    <icon>Icon.png</icon>
    <projectUrl>https://github.com/dotnet/winforms.git</projectUrl>
    <description>Private Windows Forms package, public consumption is not supported</description>
    <copyright>© Microsoft Corporation. All rights reserved.</copyright>
    <tags>WinForms Windows Forms</tags>
    <serviceable>true</serviceable>
    <repository type="git" url="https://github.com/dotnet/winforms.git" commit="89334deeed2909dcd0665157e85d16af3ccd0828" />
    <dependencies>
      <group targetFramework=".NETCoreApp5.0">
        <dependency id="Microsoft.NETCore.Platforms" version="5.0.0-alpha.1.19556.7" exclude="Build,Analyzers" />
      </group>
    </dependencies>
  </metadata>
</package>

I assume the warnings are saying we need to have all the dll's that are in our package also in the dependencies section of the nuspec, but I'm not sure how to change the csproj to achieve that.

Could use some assistance on this :)

@JohnTortugo
Copy link
Contributor Author

Do we understand the reason that these errors started showing up just now?

@nkolev92
Copy link
Contributor

nkolev92 commented Nov 14, 2019

Haven't looked into this yet (doing on-call stuff for the team week), but these warnings were added in 3.0.

Earlier versions did not have these warnings.
Finally they are just that warnings...they get elevated to errors as a good practice somewhere in your repo :)

@nkolev92
Copy link
Contributor

nkolev92 commented Nov 14, 2019

I see in https://github.com/dotnet/winforms/blob/master/pkg/Microsoft.Private.Winforms/Microsoft.Private.Winforms.csproj that most of the packaging there is custom.
https://github.com/dotnet/winforms/blob/master/pkg/Microsoft.Private.Winforms/Microsoft.Private.Winforms.csproj#L83-L91
Build output is ignored , project refs are suppressed.
It's tricky to tell what the package looks like...can you please show us the package structure.
I tried to checkout and build the repo itself but it failed some NU1202 (some packages are not on the feeds).

Related: NuGet/Home#8684

@AdamYoblick
Copy link
Member

Sure, the package in the latest build can be found at https://dnceng.visualstudio.com/internal/_build/results?buildId=427115&view=results, in the PackageArtifacts build artifact.

The structure looks like this:

image

And the generated nuspec looks like this:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>Microsoft.Private.Winforms</id>
    <version>5.0.0-alpha.1.19563.6</version>
    <authors>Microsoft</authors>
    <owners>Microsoft</owners>
    <requireLicenseAcceptance>true</requireLicenseAcceptance>
    <license type="expression">MIT</license>
    <licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
    <icon>Icon.png</icon>
    <projectUrl>https://github.com/dotnet/winforms</projectUrl>
    <description>Private Windows Forms package, public consumption is not supported</description>
    <copyright>© Microsoft Corporation. All rights reserved.</copyright>
    <tags>WinForms Windows Forms</tags>
    <serviceable>true</serviceable>
    <repository type="git" url="https://github.com/dotnet/winforms" commit="84fba2a4f9af48dfce614d3917b62fb6bf47b58c" />
    <dependencies>
      <group targetFramework=".NETCoreApp5.0">
        <dependency id="Microsoft.NETCore.Platforms" version="5.0.0-alpha.1.19556.7" exclude="Build,Analyzers" />
      </group>
    </dependencies>
  </metadata>
</package>

@AdamYoblick
Copy link
Member

We've been building this package the same way for a while now, I assume we can safely suppress these warnings, but I wanted to be sure.

@nkolev92
Copy link
Contributor

nkolev92 commented Nov 14, 2019

I assume we can safely suppress these warnings, but I wanted to be sure.

Ideally you shouldn't need to. The warnings are usually added to help customers avoid some pitfalls.
That being said...these warnings are a bit buggy :(

Given your package and nuspec, I wouldn't expect either warning to be raised.

5131 has this bug: NuGet/Home#8684.

5128 shouldn't ideally be raised.
Locally I was finally able to build the package, but I did not get NU5128?
Did something change?

I'd suggest suppressing NU5131 until the bug is fixed.

@AdamYoblick
Copy link
Member

I got latest master from the winforms repo and ran .\build.cmd -pack and I see both 5131 and 5128. My output is below.

Since this is causing our builds to fail, I think we need to suppress both for now until we figure out what the issue is?

  Successfully created package 'E:\src\repos\github\winforms\artifacts\packages\Debug\NonShipping\Microsoft.Dotnet.WinForms.ProjectTemplates.5.0.0-dev.nupkg'.
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5128: Some target frameworks declared in the dep
endencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below: [E:\src\repos\github\winforms\pkg\Microsoft.Dotnet.WinF
orms.ProjectTemplates\Microsoft.Dotnet.Winforms.ProjectTemplates.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5128: - Add lib or ref assemblies for the netcor 
eapp5.0 target framework [E:\src\repos\github\winforms\pkg\Microsoft.Dotnet.WinForms.ProjectTemplates\Microsoft.Dotnet.Winforms.ProjectTemplates.csproj]
  Successfully created package 'E:\src\repos\github\winforms\artifacts\packages\Debug\NonShipping\Microsoft.Private.Winforms.5.0.0-dev.nupkg'.
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: References were found in the nuspec, but s
ome reference assemblies were not found in both the nuspec and ref folder. Add the following reference assemblies: [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Privat
e.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add System.Drawing.dll to the netcoreapp 
5.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add System.Design.dll to the netcoreapp5 
.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add System.Drawing.Design.dll to the net 
coreapp5.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add System.Windows.Forms.dll to the netc 
oreapp5.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add System.Windows.Forms.xml to the netc 
oreapp5.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add System.Windows.Forms.Design.dll to t 
he netcoreapp5.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add System.Windows.Forms.Design.xml to t 
he netcoreapp5.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add System.Windows.Forms.Design.Editors. 
dll to the netcoreapp5.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add System.Windows.Forms.Design.Editors. 
xml to the netcoreapp5.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add Microsoft.VisualBasic.dll to the net 
coreapp5.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add Accessibility.dll to the netcoreapp5 
.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131: - Add Accessibility.xml to the netcoreapp5 
.0 reference group in the nuspec [E:\src\repos\github\winforms\pkg\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj]
E:\src\repos\github\winforms\.dotnet\sdk\5.0.100-alpha1-015536\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5131:  [E:\src\repos\github\winforms\pkg\Microso 
ft.Private.Winforms\Microsoft.Private.Winforms.csproj]

@AdamYoblick
Copy link
Member

Sorry, the 5128 warnings are on the other package we generate.

The package contents are this:

image

And the nuspec looks like this:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>Microsoft.Dotnet.WinForms.ProjectTemplates</id>
    <version>5.0.0-alpha.1.19563.6</version>
    <authors>Microsoft</authors>
    <owners>Microsoft</owners>
    <requireLicenseAcceptance>true</requireLicenseAcceptance>
    <license type="expression">MIT</license>
    <licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
    <icon>Icon.png</icon>
    <projectUrl>https://github.com/dotnet/winforms</projectUrl>
    <description>Project templates for .NET Core Windows Forms projects</description>
    <copyright>© Microsoft Corporation. All rights reserved.</copyright>
    <tags>Windows Forms WinForms Project Templates .NET Core</tags>
    <serviceable>true</serviceable>
    <repository type="git" url="https://github.com/dotnet/winforms" commit="84fba2a4f9af48dfce614d3917b62fb6bf47b58c" />
    <dependencies>
      <group targetFramework=".NETCoreApp5.0">
        <dependency id="Microsoft.NETCore.Platforms" version="5.0.0-alpha.1.19556.7" exclude="Build,Analyzers" />
      </group>
    </dependencies>
  </metadata>
</package>

@nkolev92
Copy link
Contributor

Ah, that makes a lot more sense.

That one definitely not "legal" according to the rule.

Shouldn't that package contain a template package type?
Like https://www.nuget.org/packages/Microsoft.AspNetCore.Blazor.Templates/3.1.0-preview3.19555.2 for example?

See PackageTypes in https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets.

The name is "Template".

@AdamYoblick
Copy link
Member

AdamYoblick commented Nov 14, 2019

Thanks :)

I took a look at the nuspec for AspNetCore.Blazor.Templates (since they don't generate theirs), and I do see the package types defined:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    $CommonMetadataElements$
    <packageTypes>
      <packageType name="Template" />
    </packageTypes>
  </metadata>
  <files>
    $CommonFileElements$
    <file
      src="content/**"
      exclude="**/node_modules/**;**/bin/**;**/obj/**;**/.vs/**;**/.vscode/**;**/ClientApp/dist/**;**/wwwroot/dist/**;content/Directory.Build.*"
      target="" />
  </files>
</package>

But I'm not sure how to map this to our packable csproj. I've tried adding <PackageType>Template</PackageType> to the csproj, but that didn't seem to fix the problem. I'm guessing my syntax is off? 😄

@AdamYoblick
Copy link
Member

Spoke with Nikolche offline, going to suppress these warnings to unblock our builds. Nuget team is going to look into these warnings in more detail.

@AdamYoblick
Copy link
Member

@JohnTortugo feel free to close this out

@markwilkie
Copy link
Member

Thanks @AdamYoblick - closing for @JohnTortugo as he's OOF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants