summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/StardewModdingAPI/StardewModdingAPI.csproj30
-rw-r--r--src/TrainerMod/TrainerMod.csproj5
-rw-r--r--src/common.targets32
3 files changed, 32 insertions, 35 deletions
diff --git a/src/StardewModdingAPI/StardewModdingAPI.csproj b/src/StardewModdingAPI/StardewModdingAPI.csproj
index ee03aea2..6691b2b5 100644
--- a/src/StardewModdingAPI/StardewModdingAPI.csproj
+++ b/src/StardewModdingAPI/StardewModdingAPI.csproj
@@ -261,34 +261,4 @@
</ItemGroup>
<Import Project="$(SolutionDir)\common.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
- <!-- 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 &lt;GamePath&gt; 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="$(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>
-
- <!-- 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
diff --git a/src/TrainerMod/TrainerMod.csproj b/src/TrainerMod/TrainerMod.csproj
index 03b25f8b..73b40050 100644
--- a/src/TrainerMod/TrainerMod.csproj
+++ b/src/TrainerMod/TrainerMod.csproj
@@ -101,9 +101,4 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\common.targets" />
- <Target Name="AfterBuild" Condition="$(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>
</Project> \ No newline at end of file
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 &lt;GamePath&gt; 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