-
Notifications
You must be signed in to change notification settings - Fork 53
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
Imported NuGet .targets causes additional project platforms to be displayed #1755
Comments
Thanks for the bug report @sgarske! I've added it to our backlog. It is surprising that Visual Studio would be so proactive about adding platforms based on a condition check! |
Can confirm this is still an issue today. Simply using So this code:
Becomes either this:
Or this:
Would love to see this fixed soon as it causes a headache for tools that parse projects via the MSBuild API. My current use case is writing a tool to automatically update legacy csproj files and add a |
I've just put in a quick fix for this. I think it just missed the cutoff for the next prerelease SDK, but should be available in the following one. |
Available in SDKs version 1.0.2535.41+. Thanks! |
Description
After installing the
Microsoft.Web.Webview2
NuGet package onto a C# class library (.NET Framework) project, Visual Studio will display additional project platforms that are not defined in the.csproj
.Default project platforms after creating project
After installing NuGet package
Version
SDK: At least
1.0.705.50
ofMicrosoft.Web.Webview2
NuGet package or later (also confirmed with1.0.1018-prerelease
)Runtime: N/A?
Framework: Confirmed with a WPF application project/solution and a C# Wix Custom Action library
OS: Win10
Repro Steps
Microsoft.Web.Webview2
NuGet packageI expected no additional Platforms to show besides what are defined by my project. By installing the package and the import of the
.targets
, additional platforms show.Additional context
I believe this has to do with the setting of
EffectivePlatform
at the beginning ofCommon.targets
( automatically imported byMicrosoft.Web.WebView2.targets
)I believe by just checking for conditional platforms that don't exist in the project, it triggers the project UI to show them as possible options. This causes confusion of which platforms are actually available.
I removed these lines and the issue went away.
Honestly, it feels like it may be an issue with Visual Studio and the project structure, but maybe that's just how it works? Possibly the NuGet targets can add a conditional to the whole
PropertyGroup
since it's not even needed in the .NET project case.Thanks for reading/considering.
AB#36410393
The text was updated successfully, but these errors were encountered: