<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="find-game-folder.targets" /> <UsingTask TaskName="DeployModTask" AssemblyFile="SMAPI.ModBuildConfig.dll" /> <!--********************************************* ** Set build options **********************************************--> <PropertyGroup> <!-- include PDB file by default to enable line numbers in stack traces --> <DebugType>pdbonly</DebugType> <DebugSymbols>true</DebugSymbols> <!-- don't create the 'refs' folder (which isn't useful for mods) --> <ProduceReferenceAssembly>false</ProduceReferenceAssembly> <!-- suppress processor architecture mismatch warning (mods should be compiled in 'Any CPU' so they work in both 32-bit and 64-bit mode) --> <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch> <!-- set default package options --> <ModFolderName Condition="'$(ModFolderName)' == ''">$(MSBuildProjectName)</ModFolderName> <ModZipPath Condition="'$(ModZipPath)' == ''">$(TargetDir)</ModZipPath> <GameModsPath Condition="'$(GameModsPath)' == ''">$([System.IO.Path]::Combine($(GamePath), 'Mods'))</GameModsPath> <EnableModDeploy Condition="'$(EnableModDeploy)' == ''">true</EnableModDeploy> <EnableModZip Condition="'$(EnableModZip)' == ''">true</EnableModZip> <EnableHarmony Condition="'$(EnableHarmony)' == ''">false</EnableHarmony> <EnableGameDebugging Condition="'$(EnableGameDebugging)' == ''">true</EnableGameDebugging> <BundleExtraAssemblies Condition="'$(BundleExtraAssemblies)' == ''"></BundleExtraAssemblies> <!-- coppy referenced DLLs into build output --> <CopyLocalLockFileAssemblies Condition="$(BundleExtraAssemblies.Contains('ThirdParty')) OR $(BundleExtraAssemblies.Contains('Game')) OR $(BundleExtraAssemblies.Contains('System')) OR $(BundleExtraAssemblies.Contains('All'))">true</CopyLocalLockFileAssemblies> </PropertyGroup> <PropertyGroup Condition="'$(OS)' == 'Windows_NT' AND '$(EnableGameDebugging)' == 'true'"> <!-- enable game debugging --> <StartAction>Program</StartAction> <StartProgram>$(GamePath)\StardewModdingAPI.exe</StartProgram> <StartWorkingDirectory>$(GamePath)</StartWorkingDirectory> </PropertyGroup> <!--********************************************* ** Add assembly references **********************************************--> <ItemGroup> <!-- game --> <Reference Include="Stardew Valley" HintPath="$(GamePath)\Stardew Valley.dll" Private="$(BundleExtraAssemblies.Contains('Game'))" /> <Reference Include="StardewValley.GameData" HintPath="$(GamePath)\StardewValley.GameData.dll" Private="$(BundleExtraAssemblies.Contains('Game'))" /> <Reference Include="MonoGame.Framework" HintPath="$(GamePath)\MonoGame.Framework.dll" Private="$(BundleExtraAssemblies.Contains('Game'))" /> <Reference Include="xTile" HintPath="$(GamePath)\xTile.dll" Private="$(BundleExtraAssemblies.Contains('Game'))" /> <!-- SMAPI --> <Reference Include="StardewModdingAPI" HintPath="$(GamePath)\StardewModdingAPI.dll" Private="$(BundleExtraAssemblies.Contains('Game'))" /> <Reference Include="SMAPI.Toolkit.CoreInterfaces" HintPath="$(GamePath)\smapi-internal\SMAPI.Toolkit.CoreInterfaces.dll" Private="$(BundleExtraAssemblies.Contains('Game'))" /> <!-- Harmony --> <Reference Include="0Harmony" Condition="'$(EnableHarmony)' == 'true'" HintPath="$(GamePath)\smapi-internal\0Harmony.dll" Private="$(BundleExtraAssemblies.Contains('Game'))" /> </ItemGroup> <!--********************************************* ** Show validation messages **********************************************--> <Target Name="BeforeBuild"> <!-- unknown OS type --> <Error Condition="'$(OS)' != 'OSX' AND '$(OS)' != 'Unix' AND '$(OS)' != 'Windows_NT'" Text="The mod build package doesn't recognise OS type '$(OS)'." /> <!-- invalid game path --> <Error Condition="!Exists('$(GamePath)')" Text="The mod build package can't find your game folder. You can specify where to find it; see https://smapi.io/package/custom-game-path." ContinueOnError="false" /> <Error Condition="!Exists('$(GamePath)\Stardew Valley.dll')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain the Stardew Valley file. If this folder is invalid, delete it and the package will autodetect another game install path." ContinueOnError="false" /> <Error Condition="!Exists('$(GamePath)\StardewModdingAPI.dll')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain SMAPI. You need to install SMAPI before building the mod." ContinueOnError="false" /> <!-- invalid target architecture (note: internal value is 'AnyCPU', value shown in Visual Studio is 'Any CPU') --> <Warning Condition="'$(Platform)' != 'AnyCPU'" Text="The target platform should be set to 'Any CPU' for compatibility with both 32-bit and 64-bit versions of Stardew Valley (currently set to '$(Platform)'). See https://smapi.io/package/wrong-processor-architecture for details." HelpLink="https://smapi.io/package/wrong-processor-architecture" /> </Target> <!--********************************************* ** Deploy mod files & create release zip **********************************************--> <Target Name="AfterBuild"> <DeployModTask ModDllName="$(TargetName)" ModFolderName="$(ModFolderName)" ModZipPath="$(ModZipPath)" EnableModDeploy="$(EnableModDeploy)" EnableModZip="$(EnableModZip)" ProjectDir="$(ProjectDir)" TargetDir="$(TargetDir)" GameModsDir="$(GameModsPath)" IgnoreModFilePatterns="$(IgnoreModFilePatterns)" IgnoreModFilePaths="$(IgnoreModFilePaths)" BundleExtraAssemblies="$(BundleExtraAssemblies)" /> </Target> </Project>