diff options
Diffstat (limited to 'src/common.targets')
-rw-r--r-- | src/common.targets | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/common.targets b/src/common.targets index f320cd9a..81e7e2a5 100644 --- a/src/common.targets +++ b/src/common.targets @@ -70,4 +70,36 @@ </ItemGroup> </Otherwise> </Choose> + + <!-- if game path is invalid, show one user-friendly error instead of a slew of reference errors --> + <Target Name="BeforeBuild"> + <Error Condition="!Exists('$(GamePath)')" Text="Failed to find the game install path automatically; edit the *.csproj file and manually add a <GamePath> setting with the full directory path containing the Stardew Valley executable." /> + </Target> + + <!-- copy files into game directory and enable debugging (only in debug mode) --> + <Target Name="AfterBuild" Condition="'$(MSBuildProjectName)' == 'StardewModdingAPI' AND '$(Configuration)' == 'Debug'"> + <Copy SourceFiles="$(TargetDir)\$(TargetName).exe" DestinationFolder="$(GamePath)" /> + <Copy SourceFiles="$(TargetDir)\$(TargetName).config.json" DestinationFolder="$(GamePath)" /> + <Copy SourceFiles="$(TargetDir)\StardewModdingAPI.AssemblyRewriters.dll" DestinationFolder="$(GamePath)" /> + <Copy SourceFiles="$(TargetDir)\$(TargetName).pdb" DestinationFolder="$(GamePath)" /> + <Copy SourceFiles="$(TargetDir)\$(TargetName).xml" DestinationFolder="$(GamePath)" /> + <Copy SourceFiles="$(TargetDir)\Newtonsoft.Json.dll" DestinationFolder="$(GamePath)" /> + <Copy SourceFiles="$(TargetDir)\Mono.Cecil.dll" DestinationFolder="$(GamePath)" /> + </Target> + <Target Name="AfterBuild" Condition="'$(MSBuildProjectName)' == 'TrainerMod' AND '$(Configuration)' == 'Debug'"> + <Copy SourceFiles="$(TargetDir)\$(TargetName).dll" DestinationFolder="$(GamePath)\Mods\TrainerMod" /> + <Copy SourceFiles="$(TargetDir)\$(TargetName).pdb" DestinationFolder="$(GamePath)\Mods\TrainerMod" Condition="Exists('$(TargetDir)\$(TargetName).pdb')" /> + <Copy SourceFiles="$(TargetDir)\manifest.json" DestinationFolder="$(GamePath)\Mods\TrainerMod" /> + </Target> + + <!-- launch SMAPI on debug --> + <PropertyGroup Condition="$(Configuration) == 'Debug'"> + <StartAction>Program</StartAction> + <StartProgram>$(GamePath)\StardewModdingAPI.exe</StartProgram> + <StartWorkingDirectory>$(GamePath)</StartWorkingDirectory> + </PropertyGroup> + + <!-- Somehow this makes Visual Studio for Mac recognise the previous section. Nobody knows why. --> + <PropertyGroup Condition="'$(RunConfiguration)' == 'Default'" /> + </Project>
\ No newline at end of file |