1- <!--
2- SimTools
3- Main Application
4- Project File
5- (C) Archeon Industries, LLC. 2024 - 2026, All Rights Reserved.
6-
7- ** Ongoing Projects **
8-
9- > Music Packs for the various games.
10-
11- -->
12-
13- <Project Sdk =" Microsoft.NET.Sdk" >
1+ <Project Sdk =" Microsoft.NET.Sdk" >
142
153 <PropertyGroup >
164 <BaseVersion >4.0.9</BaseVersion >
@@ -34,15 +22,16 @@ Project File
3422 <NoWarn >$(NoWarn);NETSDK1057;NETSDK1206</NoWarn >
3523 </PropertyGroup >
3624
25+ <!-- ── Configuration-Specific Debug/PDB Settings ────────────────────── -->
3726 <PropertyGroup Condition =" '$(Configuration)' == 'Debug'" >
38- <DebugSymbols >true</DebugSymbols >
39- <DebugType >portable</DebugType >
40- </PropertyGroup >
27+ <DebugSymbols >true</DebugSymbols >
28+ <DebugType >portable</DebugType >
29+ </PropertyGroup >
4130
42- <PropertyGroup Condition =" '$(Configuration)' == 'Release'" >
43- <DebugSymbols >false</DebugSymbols >
44- <DebugType >none</DebugType >
45- </PropertyGroup >
31+ <PropertyGroup Condition =" '$(Configuration)' == 'Release'" >
32+ <DebugSymbols >false</DebugSymbols >
33+ <DebugType >none</DebugType >
34+ </PropertyGroup >
4635
4736 <ItemGroup >
4837 <Resource Include =" Images\bmac.png" />
@@ -231,12 +220,9 @@ Project File
231220 <ItemGroup >
232221 <PackageReference Include =" BouncyCastle.NetCore" Version =" 2.2.1" />
233222 <PackageReference Include =" NAudio" Version =" 2.2.1" />
234- <PackageReference Include =" Obfuscar" Version =" 2.2.50" >
235- <PrivateAssets >all</PrivateAssets >
236- <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
237- </PackageReference >
238223 <PackageReference Include =" System.CodeDom" Version =" 6.0.0" />
239- <PackageReference Include =" System.Management" Version =" 6.0.2" />
224+ <!-- Exclude runtime assets here so NuGet stops creating /runtimes folder -->
225+ <PackageReference Include =" System.Management" Version =" 6.0.2" ExcludeAssets =" runtime" />
240226 <PackageReference Include =" TagLibSharp" Version =" 2.3.0" />
241227 <PackageReference Include =" WpfAnimatedGif" Version =" 2.0.2" />
242228 <PackageReference Include =" SharpCompress" Version =" 0.50.0" >
@@ -300,52 +286,39 @@ Project File
300286 <Copy SourceFiles =" @(_DepDlls)" DestinationFolder =" $(OutputPath)Dependencies" SkipUnchangedFiles =" true" />
301287
302288 <Delete Files =" @(_DepDlls)" />
289+
290+ <!-- Clean up any stray runtime folders if they somehow slip through -->
291+ <RemoveDir Directories =" $(OutputPath)runtimes" Condition =" Exists('$(OutputPath)runtimes')" />
303292 </Target >
304293
305294
306- <!-- ── 1. READ & STAMP (Runs for both x86 and x64) ────────────────────── -->
295+ <!-- ── 1. READ & STAMP (Runs for both x86 and x64) ── -->
307296 <Target Name =" ReadBuildCounter" BeforeTargets =" BeforeBuild" >
308297 <PropertyGroup >
309298 <_CounterFile >$(MSBuildProjectDirectory)\build.counter</_CounterFile >
310299 </PropertyGroup >
311300
312- <!-- Read current number (defaults to 0 if file is missing) -->
313- <ReadLinesFromFile File =" $(_CounterFile)" Condition =" Exists('$(_CounterFile)')" >
301+ <!-- Default build number to 0 if the file doesn't exist yet -->
302+ <WriteLinesToFile File =" $(_CounterFile)" Lines =" 0" Condition =" !Exists('$(_CounterFile)')" Overwrite =" false" />
303+
304+ <!-- Read current number -->
305+ <ReadLinesFromFile File =" $(_CounterFile)" >
314306 <Output TaskParameter =" Lines" ItemName =" _CounterLines" />
315307 </ReadLinesFromFile >
316308
317309 <PropertyGroup >
318- <_Build Condition =" '@(_CounterLines)' != ''" >@(_CounterLines)</_Build >
319- <_Build Condition =" '$(_Build)' == ''" >0</_Build >
320-
321- <!-- Stamp the binaries with the retrieved version -->
322- <Version >$(BaseVersion).$(_Build)</Version >
323- <AssemblyVersion >$(BaseVersion).$(_Build)</AssemblyVersion >
324- <FileVersion >$(BaseVersion).$(_Build)</FileVersion >
310+ <!-- Apply the exact same version number to both x86 and x64 builds -->
311+ <Version >$(BaseVersion).@(_CounterLines)</Version >
312+ <AssemblyVersion >$(BaseVersion).@(_CounterLines)</AssemblyVersion >
313+ <FileVersion >$(BaseVersion).@(_CounterLines)</FileVersion >
325314 </PropertyGroup >
326-
327- <Message Text =" ▶ Applying Build Number: $(_Build) (Platform: $(Platform))" Importance =" high" />
328315 </Target >
329316
330- <!-- ── 2. INCREMENT ON DISK (Only runs during x64 builds) ─────────────── -->
331- <Target Name =" IncrementBuildCounter" BeforeTargets =" BeforeBuild" DependsOnTargets =" ReadBuildCounter" Condition =" '$(DesignTimeBuild)' != 'true' And '$(Platform)' == 'x64'" >
332-
333- <PropertyGroup >
334- <!-- Increment the value we just read in memory -->
335- <_NewBuild >$([MSBuild]::Add($(_Build), 1))</_NewBuild >
336- </PropertyGroup >
337-
338- <!-- Write the incremented number back to disk for the NEXT compile cycle -->
339- <WriteLinesToFile File =" $(_CounterFile)" Lines =" $(_NewBuild)" Overwrite =" true" />
340-
341- <!-- Update the current x64 compile run to use the newly incremented number -->
342- <PropertyGroup >
343- <Version >$(BaseVersion).$(_NewBuild)</Version >
344- <AssemblyVersion >$(BaseVersion).$(_NewBuild)</AssemblyVersion >
345- <FileVersion >$(BaseVersion).$(_NewBuild)</FileVersion >
346- </PropertyGroup >
347-
348- <Message Text =" ▶ Incremented Build Counter on disk to: $(_NewBuild)" Importance =" high" />
317+ <!-- ── 2. INCREMENT (Only runs AFTER x64 finishes compiling) ── -->
318+ <Target Name =" IncrementBuildCounter" AfterTargets =" Build" Condition =" '$(DesignTimeBuild)' != 'true' And '$(Platform)' == 'x64'" >
319+ <!-- Let PowerShell cleanly add 1 and rewrite the file. No MSBuild math/convert errors possible! -->
320+ <Exec Command =" powershell -Command " $val = [int](Get-Content '$(_CounterFile)'); $val++; Set-Content '$(_CounterFile)' $val" " />
321+ <Message Text =" ▶ x64 Build Completed. Counter incremented for the next run." Importance =" high" />
349322 </Target >
350323
351324</Project >
0 commit comments