generalise NuGet package's non-mod project feature (#555)

This commit is contained in:
Jesse Plamondon-Willard 2018-06-30 14:54:15 -04:00
parent 79ad322a8e
commit 4b646e4f92
3 changed files with 26 additions and 28 deletions

View File

@ -131,18 +131,20 @@ If you don't want to include a file in the mod folder or release zip:
This is a comma-delimited list of regular expression patterns. If any pattern matches a file's This is a comma-delimited list of regular expression patterns. If any pattern matches a file's
relative path in your mod folder, that file won't be included. relative path in your mod folder, that file won't be included.
### Unit test projects ### Non-mod projects
**(upcoming in 2.1)** **(upcoming in 2.1)**
You can use the package in unit test projects too. Its optional unit test mode... You can use the package in non-mod projects too (e.g. unit tests or framework DLLs). You'll need to
disable deploying the mod and creating a release zip:
1. disables deploying the project as a mod;
2. disables creating a release zip;
2. and copies the referenced DLLs into the build output for unit test frameworks.
To enable it, add this above the first `</PropertyGroup>` in your `.csproj`:
```xml ```xml
<ModUnitTests>True</ModUnitTests> <EnableModDeploy>False</EnableModDeploy>
<EnableModZip>False</EnableModZip>
```
If this is for unit tests, you may need to copy the referenced DLLs into your build output too:
```xml
<CopyModReferencesToBuildOutput>True</CopyModReferencesToBuildOutput>
``` ```
## Code warnings ## Code warnings

View File

@ -19,14 +19,10 @@
<!-- set default settings --> <!-- set default settings -->
<ModFolderName Condition="'$(ModFolderName)' == ''">$(MSBuildProjectName)</ModFolderName> <ModFolderName Condition="'$(ModFolderName)' == ''">$(MSBuildProjectName)</ModFolderName>
<ModUnitTests Condition="'$(ModUnitTests)' == ''">False</ModUnitTests>
<ModZipPath Condition="'$(ModZipPath)' == ''">$(TargetDir)</ModZipPath> <ModZipPath Condition="'$(ModZipPath)' == ''">$(TargetDir)</ModZipPath>
<EnableModDeploy Condition="'$(EnableModDeploy)' == ''">True</EnableModDeploy> <EnableModDeploy Condition="'$(EnableModDeploy)' == ''">True</EnableModDeploy>
<EnableModZip Condition="'$(EnableModZip)' == ''">True</EnableModZip> <EnableModZip Condition="'$(EnableModZip)' == ''">True</EnableModZip>
<CopyModReferencesToBuildOutput Condition="'$(CopyModReferencesToBuildOutput)' == ''">False</CopyModReferencesToBuildOutput>
<!-- disable mod deploy in unit test project -->
<EnableModDeploy Condition="'$(ModUnitTests)' == true">False</EnableModDeploy>
<EnableModZip Condition="'$(ModUnitTests)' == true">False</EnableModZip>
</PropertyGroup> </PropertyGroup>
<!-- find platform + game path --> <!-- find platform + game path -->
@ -63,45 +59,45 @@
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>false</Private> <Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>false</Private> <Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>false</Private> <Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>false</Private> <Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="Netcode"> <Reference Include="Netcode">
<HintPath>$(GamePath)\Netcode.dll</HintPath> <HintPath>$(GamePath)\Netcode.dll</HintPath>
<Private>False</Private> <Private>False</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="Stardew Valley"> <Reference Include="Stardew Valley">
<HintPath>$(GamePath)\Stardew Valley.exe</HintPath> <HintPath>$(GamePath)\Stardew Valley.exe</HintPath>
<Private>false</Private> <Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="StardewModdingAPI"> <Reference Include="StardewModdingAPI">
<HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath> <HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
<Private>false</Private> <Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="StardewModdingAPI.Toolkit.CoreInterfaces"> <Reference Include="StardewModdingAPI.Toolkit.CoreInterfaces">
<HintPath>$(GamePath)\StardewModdingAPI.Toolkit.CoreInterfaces.dll</HintPath> <HintPath>$(GamePath)\StardewModdingAPI.Toolkit.CoreInterfaces.dll</HintPath>
<Private>false</Private> <Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86"> <Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86">
<HintPath>$(GamePath)\xTile.dll</HintPath> <HintPath>$(GamePath)\xTile.dll</HintPath>
<Private>false</Private> <Private>false</Private>
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
@ -119,27 +115,27 @@
<HintPath>$(GamePath)\MonoGame.Framework.dll</HintPath> <HintPath>$(GamePath)\MonoGame.Framework.dll</HintPath>
<Private>false</Private> <Private>false</Private>
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="StardewValley"> <Reference Include="StardewValley">
<HintPath>$(GamePath)\StardewValley.exe</HintPath> <HintPath>$(GamePath)\StardewValley.exe</HintPath>
<Private>false</Private> <Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="StardewModdingAPI"> <Reference Include="StardewModdingAPI">
<HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath> <HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
<Private>false</Private> <Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="StardewModdingAPI.Toolkit.CoreInterfaces"> <Reference Include="StardewModdingAPI.Toolkit.CoreInterfaces">
<HintPath>$(GamePath)\StardewModdingAPI.Toolkit.CoreInterfaces.dll</HintPath> <HintPath>$(GamePath)\StardewModdingAPI.Toolkit.CoreInterfaces.dll</HintPath>
<Private>false</Private> <Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
<Reference Include="xTile"> <Reference Include="xTile">
<HintPath>$(GamePath)\xTile.dll</HintPath> <HintPath>$(GamePath)\xTile.dll</HintPath>
<Private>false</Private> <Private>false</Private>
<Private Condition="$(ModUnitTests)">true</Private> <Private Condition="$(CopyModReferencesToBuildOutput)">true</Private>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
</Otherwise> </Otherwise>

View File

@ -14,7 +14,7 @@
<releaseNotes> <releaseNotes>
2.1: 2.1:
- Added support for Stardew Valley 1.3. - Added support for Stardew Valley 1.3.
- Added support for unit test projects. - Added support for non-mod projects.
- Added C# analyzers to warn about implicit conversions of Netcode fields in Stardew Valley 1.3. - Added C# analyzers to warn about implicit conversions of Netcode fields in Stardew Valley 1.3.
- Added option to ignore files by regex pattern. - Added option to ignore files by regex pattern.
- Added reference to new SMAPI DLL. - Added reference to new SMAPI DLL.