Open Leon99 opened 1 year ago
I think the MSBuild APis don't allow that. I'm looking at the source for another matter, but the API used AddItem)))) doesn't seem to allow selecting the ItemGroup, let alone creating an ItemGroup with conditions. But I've just started playign around with it. If you care to have a look yourself, look at SwitchProjectsToPackagesCommand
and SwitchPackagesToProjectsCommand
- the code is reasonably easy to understand.
Currently, switching between projects and packages may cause unexpected changes due to moving the PackageReference/ProjectReference to an ItemGroup without a Condition.
A typical approach when multitargeting is to have something like this:
Using dnt to switch that package will result in referencing it unconditionally.
Is there a way to keep the replaced reference with the same ItemGroup on switching?