-
Notifications
You must be signed in to change notification settings - Fork 120
/
common.targets
137 lines (118 loc) · 5.07 KB
/
common.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="ReplaceMenifestVersion" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<InputFilename ParameterType="System.String" Required="true" />
<CurrentVersion ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Text.RegularExpressions" />
<Code Type="Fragment" Language="cs">
<![CDATA[
File.WriteAllText(
InputFilename,
Regex.Replace(File.ReadAllText(InputFilename), "\"Version\": \".+\",", "\"Version\": \""+CurrentVersion+"\",")
);
]]>
</Code>
</Task>
</UsingTask>
<UsingTask TaskName="AutoIncrementVersion" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<ProjectFile ParameterType="System.String" Required="true" />
<CurrentVersion ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Text.RegularExpressions" />
<Code Type="Fragment" Language="cs">
<![CDATA[
string[] version = CurrentVersion.Split('.');
string[] patch = version[2].Split('-');
patch[0] = (int.Parse(patch[0]) + 1).ToString();
version[2] = string.Join("-",patch);
string newVersion = string.Join(".",version);
File.WriteAllText(
ProjectFile,
Regex.Replace(File.ReadAllText(ProjectFile), "<Version>.+</Version>", "<Version>"+newVersion+"</Version>")
);
]]>
</Code>
</Task>
</UsingTask>
<PropertyGroup>
<Platforms>anycpu</Platforms>
<PlatformTarget>anycpu</PlatformTarget>
<EnableHarmony>true</EnableHarmony>
<ModZipPath>$(SolutionDir)_releases</ModZipPath>
<Configurations>Debug;Release;Android;Prealpharelease;Prealphadebug</Configurations>
<!--<IgnoreModFilePatterns Condition="'$(MSBuildProjectName)' != 'PyTK'">PlatoTK\.(?:dll|pdb), Newtonsoft.Json.Bson\.(?:dll|pdb), DotNetZip\.(?:dll|pdb),PyTK\.(?:dll|pdb),0Harmony\.(?:dll|pdb), MoonSharp.Interpreter\.(?:dll|pdb), NCalc\.(?:dll|pdb),TMXTile\.(?:dll|pdb)</IgnoreModFilePatterns>-->
<Authors>Platonymous</Authors>
<RepositoryUrl>https://github.com/Platonymous/Stardew-Valley-Mods</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Android' ">
<GamePath>C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\SDV 1.4</GamePath>
<ModZipPath>$(SolutionDir)_releases_android</ModZipPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Prealpharelease' ">
<GamePath>C:\Program Files (x86)\Steam\steamapps\common\SDV15</GamePath>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Prealphadebug' ">
<GamePath>C:\Program Files (x86)\Steam\steamapps\common\SDV15</GamePath>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release' ">
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug' ">
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<NoWarn>NU1701</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Android|AnyCPU' ">
<DefineConstants>ANDROID;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Update="manifest.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="content.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="assets/**/*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="i18n/*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="config.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="ReplaceMenifestVersion" BeforeTargets="AfterBuild">
<ReplaceMenifestVersion
InputFilename="$(ProjectDir)manifest.json"
CurrentVersion="$(Version)" />
<ItemGroup>
<OldVersions Include="$(ModZipPath)\$(ProjectName)*.zip;$(ModZipPath)\$(ModFolderName)*.zip"/>
</ItemGroup>
<Delete Files="@(OldVersions)" />
</Target>
<!--
<Target Name="AutoIncrementVersion" AfterTargets="AfterBuild">
<AutoIncrementVersion
ProjectFile="$(ProjectDir)$(ProjectName).csproj"
CurrentVersion="$(Version)" />
</Target>
-->
<ItemGroup>
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.0.1" />
</ItemGroup>
</Project>