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

Workaround NuGet breaking change #2165

Merged
merged 1 commit into from
Mar 5, 2019

Conversation

ericstj
Copy link
Member

@ericstj ericstj commented Mar 5, 2019

NuGet removed Manifest.Save(Stream, bool) in the latest version.
Since NuGet is part of MSBuild our task is forcibly upgraded to the
latest version when running in the latest SDK. This results in a
missing method exception.

Workaround it by calling an API that NuGet didn't remove. This can
potentially cause failures in GenerateNuSpec because it will now run
Validation, however anyone using the Pack task in our package should
already be passing validation since NuGet runs the same validation
when reading the Manifest.

Replaces #2004.

NuGet removed Manifest.Save(Stream, bool) in the latest version.
Since NuGet is part of MSBuild our task is forcibly upgraded to the
latest version when running in the latest SDK.  This results in a
missing method exception.

Workaround it by calling an API that NuGet didn't remove.  This can
potentially cause failures in GenerateNuSpec because it will now run
Validation, however anyone using the Pack task in our package should
already be passing validation since NuGet runs the same validation
when reading the Manifest.
@ericstj ericstj requested review from wli3 and ViktorHofer March 5, 2019 17:45
@ericstj
Copy link
Member Author

ericstj commented Mar 5, 2019

I've tested on CoreFx and it fixes building packages with the latest SDK. Our original use of the broken API comes from our use of NuProj, which still has this bug. As I mentioned above, we were still running validation during Pack for all of our scenarios so the risk of a break from this change is pretty low.

@tmat
Copy link
Member

tmat commented Mar 5, 2019

@ericstj Why can't we use the existing PackTask to generate NuSpec? What is it missing?

@tmat tmat closed this Mar 5, 2019
@tmat tmat reopened this Mar 5, 2019
@tmat
Copy link
Member

tmat commented Mar 5, 2019

(Sorry, closed the PR by accident)

@ericstj
Copy link
Member Author

ericstj commented Mar 5, 2019

@tmat see #1033. NuGet actually doesn't have a good replacement for GenerateNuSpec, but its possible that Pack might support enough inputs that we could avoid the NuSpec intermediate. We'd have to see when making those fixes.

@ericstj ericstj requested a review from safern March 5, 2019 18:40
@ericstj
Copy link
Member Author

ericstj commented Mar 5, 2019

Just for reference (and for folks doing a callstack search) this is fixing:

System.MissingMethodException: Method not found: 'Void NuGet.Packaging.Manifest.Save(System.IO.Stream, Boolean)'.
   at Microsoft.DotNet.Build.Tasks.Packaging.GenerateNuSpec.WriteNuSpecFile()
   at Microsoft.DotNet.Build.Tasks.Packaging.GenerateNuSpec.Execute()

That was caused by NuGet/NuGet.Client#2438.

We're working around it by calling an API that was not removed.

@ericstj ericstj merged commit 72de932 into dotnet:master Mar 5, 2019
@ViktorHofer
Copy link
Member

Thanks for fixing!

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

Successfully merging this pull request may close these issues.

4 participants