From da2e4a3bfba2b6c148e1cf1b6023da2954d7386a Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Wed, 17 Dec 2025 03:06:42 -0300 Subject: [PATCH] Ensure properties are always set in props+targets This prevents a scenario where the .NET SDK props don't get a key property early enough (i.e. TargetFramework) from the script and uses the one in the .csproj which was intended to be overriden. --- src/SmallSharp/EmitTargets.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SmallSharp/EmitTargets.cs b/src/SmallSharp/EmitTargets.cs index 2aa787b..c3b68e1 100644 --- a/src/SmallSharp/EmitTargets.cs +++ b/src/SmallSharp/EmitTargets.cs @@ -123,7 +123,10 @@ public override bool Execute() WriteXml(Path.Combine(BaseIntermediateOutputPath, "SmallSharp.sdk.targets"), new XElement("Project", sdks.Select(x => new XElement("Import", [new XAttribute("Project", "Sdk.targets"), .. x])))); + // We emit properties both to .props and .targets to ensure all values + // are strictly what's set in the script, either before or after .NET SDK reads them. WriteXml(PropsFile, new XElement("Project", + new XElement("PropertyGroup", properties), new XElement("PropertyGroup", [new XElement("SmallSharpProjectExtensionPropsImported", "true")])));