Skip to content

Commit 6cd6d58

Browse files
committed
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.
1 parent c81b942 commit 6cd6d58

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/SmallSharp/EmitTargets.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ public override bool Execute()
123123
WriteXml(Path.Combine(BaseIntermediateOutputPath, "SmallSharp.sdk.targets"), new XElement("Project",
124124
sdks.Select(x => new XElement("Import", [new XAttribute("Project", "Sdk.targets"), .. x]))));
125125

126+
// We emit properties both to .props and .targets to ensure all values
127+
// are strictly what's set in the script, either before or after .NET SDK reads them.
126128
WriteXml(PropsFile, new XElement("Project",
129+
new XElement("PropertyGroup", properties),
127130
new XElement("PropertyGroup",
128131
[new XElement("SmallSharpProjectExtensionPropsImported", "true")])));
129132

0 commit comments

Comments
 (0)