Argamon;14914 wrote:
So I would expect that when NCrunch builds, the property XmlDoc2CmdletDocCommand is first set when the csproj is read, then the NuGet packages target file is read and everything is back to the normal value.
Yes. Sadly this was much simpler under the old .NET Framework, because we could control the order in which targets are included in the build file. Under the new CPS system, MSBuild implicitly declares the imports after the .csproj, making it hard to override them.
It's still possible though. You can just use the 'BeforeTargets' parameter to declare your own target that injects itself into the build sequence to override the property after its default is already set:
<Target Name="OverrideXmlDoc2CmdletDoc"
BeforeTargets="XmlDoc2CmdletDoc"
Condition="'$(NCrunch)' == '1'">
<PropertyGroup>
<XmlDoc2CmdletDocCommand>echo Do nothing</XmlDoc2CmdletDocCommand>
</PropertyGroup>
</Target>
In theory, the properties set by the 'Custom build properties' setting should override properties declared in the project file and included targets. In practice, MSBuild is a strange machine that has changed a great deal over the years. Maybe this particular approach doesn't work on your setup.