You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I found was that when using the option CombineRootElements, the <PreBuildEvent> element gets combined and moved up to the top <PropertyGroup> parent.
The issue with this is the $(ProjectPath) needs to be after the <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> line otherwise the variable is blank.
This means when running the first time, it works. But running it a second time, the sorting event fails due to passing a blank parameter.
The fix is to make sure the <PreBuildEvent> (and other event elements) are excluded from the combine and also make sure they are always placed after the <Import> target elements.
The text was updated successfully, but these errors were encountered:
@Chris-GH Take a look at the Option Sections. If you have certain sections that have to appear in a specific order, you can use them to make that happen. Another benefit to this is that you can specify different options for each section.
I was trying to create a build event that sorts the csproj files pre-build.
And have the following code:
What I found was that when using the option
CombineRootElements
, the<PreBuildEvent>
element gets combined and moved up to the top<PropertyGroup>
parent.The issue with this is the
$(ProjectPath)
needs to be after the<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
line otherwise the variable is blank.This means when running the first time, it works. But running it a second time, the sorting event fails due to passing a blank parameter.
The fix is to make sure the
<PreBuildEvent>
(and other event elements) are excluded from the combine and also make sure they are always placed after the<Import>
target elements.The text was updated successfully, but these errors were encountered: