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

IncludePackageReferencesDuringMarkupCompilation causes excluded NuGet targets/props files to be executed #4311

Open
nick-beer opened this issue Mar 22, 2021 · 1 comment
Assignees
Labels
Bug Product bug (most likely)

Comments

@nick-beer
Copy link

If you conditionally exclude a NuGet package based on whether we're in the wpf MarkupCompile phase (the _wpftmp project), any .targets or .props files in that NuGet packages build folder will still be executed during the _wpftmp build if IncludePackageReferencesDuringMarkupCompilation is true.

This behavior was surprising to me. Now that I've read through the code in Microsoft.WinFX.targets, I can understand the why things happen the way they do, but thought it was worth reporting anyways.

For some background, we use a code analysis NuGet package that I wanted to turn off during the MarkupCompile/inner build of the _wpftmp project. The analyzers are slow, we have more warnings than I'm proud of, and with them enabled during the _wpftmp build we get twice the number of warnings. I thought I would be able to put a condition on the PackageReference that excludes the package if we're in the _wpftmp build. However, when I did that, projects that had IncludePackageReferencesDuringMarkupCompilation set to true failed to build because the package wasn't included but the package's .targets file from the build folder was still executing.

I've created a small project that reproduces the issue. You can get it here.

SDK Version 5.0.104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Product bug (most likely)
Projects
None yet
Development

No branches or pull requests

4 participants