simplify debugging

This commit is contained in:
Jesse Plamondon-Willard 2016-11-09 11:11:40 -05:00
parent 7fa591cf22
commit 69ffdb91b2
2 changed files with 20 additions and 5 deletions

View File

@ -34,6 +34,11 @@ SMAPI uses build configuration derived from the [crosswiki mod config](https://g
to detect your current OS automatically and load the correct references. Compile output will be
placed in a `bin` directory at the root of the git repository.
### Debugging a local build
Rebuilding the solution in debug mode will copy the SMAPI files into your game directory. Starting
the `StardewModdingAPI` project with debugging will launch SMAPI with the debugger attached, so you
can intercept errors and step through the code being executed.
### Preparing a release
To prepare a crossplatform SMAPI release, you'll need to compile it on two platforms. See
_[crossplatforming a SMAPI mod](http://canimod.com/guides/crossplatforming-a-smapi-mod#preparing-a-mod-release)_

View File

@ -79,9 +79,6 @@
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<StartupObject>StardewModdingAPI.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<!-- Linux paths -->
<GamePath Condition="!Exists('$(GamePath)')">$(HOME)/GOG Games/Stardew Valley/game</GamePath>
@ -252,15 +249,28 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="..\packages\Fody.1.29.4\build\dotnet\Fody.targets" Condition="$(OS) == 'WINDOWS_NT' AND Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" />
<!-- merge Json.NET into the assembly (only in release mode to allow debugging, and only for Windows since Costura isn't crossplatform) -->
<Import Project="..\packages\Fody.1.29.4\build\dotnet\Fody.targets" Condition="$(Configuration) != 'Debug' AND $(OS) == 'WINDOWS_NT' AND Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.4\build\dotnet\Fody.targets'))" />
</Target>
<!-- if game path is invalid, show one user-friendly error instead of a slew of reference errors -->
<Target Name="BeforeBuild">
<!-- if game path is invalid, show one user-friendly error instead of a slew of reference errors -->
<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, and only in Windows because I haven't tried it with Linux/Mac) -->
<PropertyGroup Condition="$(Configuration) == 'Debug' AND $(OS) == 'Windows_NT'">
<StartAction>Program</StartAction>
<StartProgram>$(GamePath)\StardewModdingAPI.exe</StartProgram>
<StartWorkingDirectory>$(GamePath)</StartWorkingDirectory>
</PropertyGroup>
<Target Name="AfterBuild">
<Copy SourceFiles="$(TargetDir)\$(TargetName).exe" DestinationFolder="$(GamePath)" />
<Copy SourceFiles="$(TargetDir)\$(TargetName).pdb" DestinationFolder="$(GamePath)" />
<Copy SourceFiles="$(TargetDir)\$(TargetName).xml" DestinationFolder="$(GamePath)" />
<Copy SourceFiles="$(TargetDir)\Newtonsoft.Json.dll" DestinationFolder="$(GamePath)" />
</Target>
</Project>