Simplify MainSlnExecutable.props

makes it play nicer with Rider WinForms designer and is much simpler than what was present before

also not sure where the "TargetName changing AssemblyName" behavior actually came from, testing on Rider/dotnet build/VS2022 all yield no changes to AssemblyName, so I assume this is fine
This commit is contained in:
CasualPokePlayer 2024-06-20 15:13:40 -07:00
parent 256218305b
commit 1edddb2126
1 changed files with 5 additions and 11 deletions

View File

@ -5,12 +5,10 @@
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 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>
<!-- Setting TargetName changes the output file name while preserving the AssemblyName -->
<TargetName>$(MSBuildProjectName.Substring($([MSBuild]::Add($(MSBuildProjectName.LastIndexOf('.')), 1))))</TargetName>
<!-- 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)$(TargetFileName)</TargetPath>
<TargetPath>$(ExecFilesDest)$(TargetName).exe</TargetPath>
</PropertyGroup>
<ItemGroup>
<!-- This is somewhat wasteful for DiscoHawk, but it still relies on some unmanaged libraries
@ -25,13 +23,9 @@
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<ItemGroup>
<ExecFilesFromExecProj Include="$(OutputPath)$(MSBuildProjectName).*" /> <!-- doesn't include the .exe.config because those are automatically renamed??? -->
<ExecConfigFilesFromExecProj Include="$(OutputPath)$(TargetFileName).*" /> <!-- include the .exe.config files -->
<ExecFilesFromExecProj Include="$(OutputPath)$(TargetFileName).*" /> <!-- note: doesn't include the .xml file (although we wouldn't want to rename/move that) -->
</ItemGroup>
<!-- 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)" />
<Move SourceFiles="@(ExecFilesFromExecProj)" DestinationFolder="$(ExecFilesDest)" />
<MakeDir Directories="$(ExecFilesDest)ExternalTools;$(ExecFilesDest)Firmware;$(ExecFilesDest)Tools" />
</Target>
</Project>