Revert "Simplify MainSlnExecutable.props"

This reverts commit 1edddb2126.
This commit is contained in:
CasualPokePlayer 2024-06-20 16:21:58 -07:00
parent 1edddb2126
commit a11077ef4e
1 changed files with 11 additions and 5 deletions

View File

@ -5,10 +5,12 @@
This allows us to have the executable dependencies automagically copied over to our dll folder while still keeping the executable in the output folder. -->
<OutputPath>$(MSBuildProjectDirectory)/../../output/dll/</OutputPath>
<ExecFilesDest>$(MSBuildProjectDirectory)/../../output/</ExecFilesDest>
<!-- Setting TargetName changes the output file name while preserving the AssemblyName -->
<TargetName>$(MSBuildProjectName.Substring($([MSBuild]::Add($(MSBuildProjectName.LastIndexOf('.')), 1))))</TargetName>
<!-- Setting TargetFileName does not change the AssemblyName (as setting TargetName would), but also does not change the output file name
for the executable on build (as one would expect). So we still need to rename the executable file below. Using this method has the advantage
of IDEs respecting the TargetFileName and expecting it. -->
<TargetFileName>$(MSBuildProjectName.Substring($([MSBuild]::Add($(MSBuildProjectName.LastIndexOf('.')), 1)))).exe</TargetFileName>
<!-- This also doesn't actually change where the executable is output, rather it's just a hint to the IDE to know where the executable is (since we move it). -->
<TargetPath>$(ExecFilesDest)$(TargetName).exe</TargetPath>
<TargetPath>$(ExecFilesDest)$(TargetFileName)</TargetPath>
</PropertyGroup>
<ItemGroup>
<!-- This is somewhat wasteful for DiscoHawk, but it still relies on some unmanaged libraries
@ -23,9 +25,13 @@
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<ItemGroup>
<ExecFilesFromExecProj Include="$(OutputPath)$(TargetFileName).*" /> <!-- note: doesn't include the .xml file (although we wouldn't want to rename/move that) -->
<ExecFilesFromExecProj Include="$(OutputPath)$(MSBuildProjectName).*" /> <!-- doesn't include the .exe.config because those are automatically renamed??? -->
<ExecConfigFilesFromExecProj Include="$(OutputPath)$(TargetFileName).*" /> <!-- include the .exe.config files -->
</ItemGroup>
<Move SourceFiles="@(ExecFilesFromExecProj)" DestinationFolder="$(ExecFilesDest)" />
<!-- Surely this can be done in one step, right? FIXME -->
<Move SourceFiles="@(ExecFilesFromExecProj)" DestinationFiles="@(ExecFilesFromExecProj->Replace('BizHawk.Client.', ''))" />
<Move SourceFiles="@(ExecFilesFromExecProj->Replace('BizHawk.Client.', ''))" DestinationFolder="$(ExecFilesDest)" />
<Move SourceFiles="@(ExecConfigFilesFromExecProj)" DestinationFolder="$(ExecFilesDest)" />
<MakeDir Directories="$(ExecFilesDest)ExternalTools;$(ExecFilesDest)Firmware;$(ExecFilesDest)Tools" />
</Target>
</Project>