Open AArnott opened 6 years ago
@jinujoseph @AArnott Is there any workaround for this? (apart from "don't use the MSBuild.Sdk.Extras project") This bug currently means that we can't run our custom analyzers on any solution (not just the one project) that includes a WPF project that uses MSBuild.Sdk.Extras.
It'd be alright if we could somehow exclude the one project from being analysed.
Talking with @ DustinCampbell , unfortunately doesn't seem to have any good workaround.
It looks like we’d need to make a change in MSBuildWorkspace to avoid deleting the
I encountered the same situation (with MSBuild.Sdk.Extras). Wonder if any progress has been made on this matter?
@pistonexia I simply created a fork of the MSBuild.Sdk.Extras package that doesn't rewrite the target frameworks. It's completely trivial assuming you only use lowercase target frameworks.
Need to check but I have a hunch that https://github.com/dotnet/roslyn/pull/39748 might fix this issue.
The
ProjectFile.GetProjectFileInfosAsync
method rotates through setting aTargetFramework
property for each value inTargetFrameworks
for a project. But when the project imports MSBuild.Sdk.Extras (or otherwise imports a .targets file at the end of the project file that re-sets the<TargetFramework>
property), this method throws an exception by calling into MSBuild asking it to delete the property as it is defined in the .targets file instead of the property set in the root project file itself.