|
14 | 14 | <OutRootPath>$(SolutionDir)\..\bin</OutRootPath> |
15 | 15 |
|
16 | 16 | <SmapiBin>$(BuildRootPath)\SMAPI\bin\$(Configuration)</SmapiBin> |
17 | | - <ToolkitBin>$(BuildRootPath)\SMAPI.Toolkit\bin\$(Configuration)\net452</ToolkitBin> |
| 17 | + <ToolkitBin>$(BuildRootPath)\SMAPI.Toolkit\bin\$(Configuration)\net5.0</ToolkitBin> |
18 | 18 | <ConsoleCommandsBin>$(BuildRootPath)\SMAPI.Mods.ConsoleCommands\bin\$(Configuration)</ConsoleCommandsBin> |
19 | 19 | <ErrorHandlerBin>$(BuildRootPath)\SMAPI.Mods.ErrorHandler\bin\$(Configuration)</ErrorHandlerBin> |
20 | 20 | <SaveBackupBin>$(BuildRootPath)\SMAPI.Mods.SaveBackup\bin\$(Configuration)</SaveBackupBin> |
|
35 | 35 | <Copy SourceFiles="$(TargetDir)\assets\unix-install.sh" DestinationFiles="$(PackagePath)\install on Linux.sh" /> |
36 | 36 | <Copy SourceFiles="$(TargetDir)\assets\unix-install.sh" DestinationFiles="$(PackagePath)\install on macOS.command" /> |
37 | 37 | <Copy SourceFiles="$(TargetDir)\assets\windows-install.bat" DestinationFiles="$(PackagePath)\install on Windows.bat" /> |
38 | | - <Copy SourceFiles="$(TargetDir)\assets\README.txt" DestinationFiles="$(PackagePath)\README.txt" /> |
39 | | - <Copy SourceFiles="$(TargetDir)\$(TargetName).exe" DestinationFiles="$(PackagePath)\internal\$(PlatformName)-install.exe" /> |
40 | | - <Copy Condition="$(PlatformName) == 'windows'" SourceFiles="$(TargetDir)\assets\windows-exe-config.xml" DestinationFiles="$(PackagePath)\internal\$(PlatformName)-install.exe.config" /> |
| 38 | + <Copy SourceFiles="$(TargetDir)\assets\README.txt" DestinationFolder="$(PackagePath)" /> |
| 39 | + <Copy SourceFiles="$(TargetDir)\$(TargetName).dll" DestinationFolder="$(PackagePath)\internal" /> |
| 40 | + <Copy SourceFiles="$(TargetDir)\$(TargetName).exe" DestinationFiles="$(PackagePath)\internal\$(PlatformName)-install.exe" Condition="$(PlatformName) == 'windows'" /> |
| 41 | + <Copy SourceFiles="$(TargetDir)\$(TargetName)" DestinationFiles="$(PackagePath)\internal\$(PlatformName)-install" Condition="$(PlatformName) != 'windows'" /> |
| 42 | + <Copy SourceFiles="$(TargetDir)\$(TargetName).runtimeconfig.json" DestinationFolder="$(PackagePath)\internal" /> |
| 43 | + <Copy SourceFiles="$(TargetDir)\assets\windows-exe-config.xml" DestinationFiles="$(PackagePath)\internal\$(PlatformName)-install.exe.config" Condition="$(PlatformName) == 'windows'" /> |
41 | 44 |
|
42 | 45 | <!--copy bundle files--> |
43 | | - <Copy SourceFiles="$(SmapiBin)\StardewModdingAPI.exe" DestinationFolder="$(PackagePath)\bundle" /> |
| 46 | + <Copy SourceFiles="$(SmapiBin)\StardewModdingAPI.dll" DestinationFolder="$(PackagePath)\bundle" /> |
| 47 | + <Copy SourceFiles="$(SmapiBin)\StardewModdingAPI.exe" DestinationFolder="$(PackagePath)\bundle" Condition="$(PlatformName) == 'windows'" /> |
| 48 | + <Copy SourceFiles="$(SmapiBin)\StardewModdingAPI" DestinationFolder="$(PackagePath)\bundle" Condition="$(PlatformName) != 'windows'" /> |
44 | 49 | <Copy SourceFiles="$(SmapiBin)\StardewModdingAPI.pdb" DestinationFolder="$(PackagePath)\bundle" /> |
45 | 50 | <Copy SourceFiles="$(SmapiBin)\StardewModdingAPI.xml" DestinationFolder="$(PackagePath)\bundle" /> |
46 | 51 | <Copy SourceFiles="$(SmapiBin)\steam_appid.txt" DestinationFolder="$(PackagePath)\bundle" /> |
|
61 | 66 | <Copy SourceFiles="$(ToolkitBin)\SMAPI.Toolkit.CoreInterfaces.pdb" DestinationFolder="$(PackagePath)\bundle\smapi-internal" /> |
62 | 67 | <Copy SourceFiles="$(ToolkitBin)\SMAPI.Toolkit.CoreInterfaces.xml" DestinationFolder="$(PackagePath)\bundle\smapi-internal" /> |
63 | 68 | <Copy SourceFiles="@(TranslationFiles)" DestinationFolder="$(PackagePath)\bundle\smapi-internal\i18n" /> |
64 | | - <Copy Condition="$(PlatformName) == 'unix'" SourceFiles="$(TargetDir)\assets\unix-launcher.sh" DestinationFiles="$(PackagePath)\bundle\StardewModdingAPI" /> |
65 | | - <Copy Condition="$(PlatformName) == 'unix'" SourceFiles="$(SmapiBin)\System.Numerics.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" /> |
| 69 | + <Copy Condition="$(PlatformName) == 'unix'" SourceFiles="$(TargetDir)\assets\unix-launcher.sh" DestinationFolder="$(PackagePath)\bundle" /> |
66 | 70 | <Copy Condition="$(PlatformName) == 'unix'" SourceFiles="$(SmapiBin)\System.Runtime.Caching.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" /> |
67 | 71 | <Copy Condition="$(PlatformName) == 'windows'" SourceFiles="$(TargetDir)\assets\windows-exe-config.xml" DestinationFiles="$(PackagePath)\bundle\StardewModdingAPI.exe.config" /> |
68 | 72 |
|
| 73 | + <!-- copy .NET dependencies --> |
| 74 | + <Copy SourceFiles="$(SmapiBin)\System.Configuration.ConfigurationManager.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" /> |
| 75 | + <Copy SourceFiles="$(SmapiBin)\System.Management.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" Condition="$(PlatformName) == 'windows'" /> |
| 76 | + <Copy SourceFiles="$(SmapiBin)\System.Runtime.Caching.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" /> |
| 77 | + <Copy SourceFiles="$(SmapiBin)\System.Security.Permissions.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" /> |
| 78 | + |
69 | 79 | <!--copy bundled mods--> |
70 | 80 | <Copy SourceFiles="$(ConsoleCommandsBin)\ConsoleCommands.dll" DestinationFolder="$(PackagePath)\bundle\Mods\ConsoleCommands" /> |
71 | 81 | <Copy SourceFiles="$(ConsoleCommandsBin)\ConsoleCommands.pdb" DestinationFolder="$(PackagePath)\bundle\Mods\ConsoleCommands" /> |
|
78 | 88 | <Copy SourceFiles="$(SaveBackupBin)\SaveBackup.pdb" DestinationFolder="$(PackagePath)\bundle\Mods\SaveBackup" /> |
79 | 89 | <Copy SourceFiles="$(SaveBackupBin)\manifest.json" DestinationFolder="$(PackagePath)\bundle\Mods\SaveBackup" /> |
80 | 90 |
|
81 | | - <!-- fix errors on Linux/macOS (sample: https://smapi.io/log/mMdFUpgB) --> |
82 | | - <Copy Condition="$(PlatformName) == 'unix'" SourceFiles="$(TargetDir)\assets\System.Numerics.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" /> |
83 | | - <Copy Condition="$(PlatformName) == 'unix'" SourceFiles="$(TargetDir)\assets\System.Runtime.Caching.dll" DestinationFolder="$(PackagePath)\bundle\smapi-internal" /> |
84 | | - |
85 | 91 | <!-- fix Linux/macOS permissions --> |
86 | | - <Exec Condition="$(PlatformName) == 'unix'" Command="chmod 755 "$(PackagePath)\install on Linux.sh"" /> |
87 | | - <Exec Condition="$(PlatformName) == 'unix'" Command="chmod 755 "$(PackagePath)\install on macOS.command"" /> |
| 92 | + <Exec Condition="$(PlatformName) == 'unix'" Command="chmod 755 "$(PackagePath)/install on Linux.sh"" /> |
| 93 | + <Exec Condition="$(PlatformName) == 'unix'" Command="chmod 755 "$(PackagePath)/install on macOS.command"" /> |
| 94 | + <Exec Condition="$(PlatformName) == 'unix'" Command="chmod 755 "$(PackagePath)/bundle/unix-launcher.sh"" /> |
88 | 95 |
|
89 | 96 | <!-- finalise 'for developers' installer --> |
90 | 97 | <ItemGroup> |
91 | 98 | <PackageFiles Include="$(PackagePath)\**\*.*" /> |
92 | 99 | </ItemGroup> |
93 | 100 | <Copy SourceFiles="@(PackageFiles)" DestinationFolder="$(PackageDevPath)\%(RecursiveDir)" /> |
94 | | - <ZipDirectory FromDirPath="$(PackageDevPath)\bundle" ToFilePath="$(PackageDevPath)\internal\$(PlatformName)-install.dat" /> |
| 101 | + <ZipDirectory SourceDirectory="$(PackageDevPath)\bundle" DestinationFile="$(PackageDevPath)\internal\$(PlatformName)-install.dat" /> |
95 | 102 | <RemoveDir Directories="$(PackageDevPath)\bundle" /> |
96 | 103 |
|
97 | 104 | <!-- finalise normal installer --> |
98 | 105 | <ReplaceFileText FilePath="$(PackagePath)\bundle\smapi-internal\config.json" Search=""DeveloperMode": true" Replace=""DeveloperMode": false" /> |
99 | | - <ZipDirectory FromDirPath="$(PackagePath)\bundle" ToFilePath="$(PackagePath)\internal\$(PlatformName)-install.dat" /> |
| 106 | + <ZipDirectory SourceDirectory="$(PackagePath)\bundle" DestinationFile="$(PackagePath)\internal\$(PlatformName)-install.dat" /> |
100 | 107 | <RemoveDir Directories="$(PackagePath)\bundle" /> |
101 | 108 | </Target> |
102 | 109 |
|
103 | | - <!-- Create a zip file with the contents of a given folder path. Derived from https://stackoverflow.com/a/38127938/262123. --> |
104 | | - <UsingTask TaskName="ZipDirectory" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll"> |
105 | | - <ParameterGroup> |
106 | | - <FromDirPath ParameterType="System.String" Required="true" /> |
107 | | - <ToFilePath ParameterType="System.String" Required="true" /> |
108 | | - </ParameterGroup> |
109 | | - <Task> |
110 | | - <Reference Include="System.IO.Compression.FileSystem" /> |
111 | | - <Using Namespace="System.IO.Compression" /> |
112 | | - <Code Type="Fragment" Language="cs"> |
113 | | - <![CDATA[ |
114 | | - try |
115 | | - { |
116 | | - ZipFile.CreateFromDirectory(FromDirPath, ToFilePath); |
117 | | - return true; |
118 | | - } |
119 | | - catch(Exception ex) |
120 | | - { |
121 | | - Log.LogErrorFromException(ex); |
122 | | - return false; |
123 | | - } |
124 | | - ]]> |
125 | | - </Code> |
126 | | - </Task> |
127 | | - </UsingTask> |
128 | | - |
129 | 110 | <!-- Replace text in a file based on a regex pattern. Derived from https://stackoverflow.com/a/22571621/262123. --> |
130 | | - <UsingTask TaskName="ReplaceFileText" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> |
| 111 | + <UsingTask TaskName="ReplaceFileText" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll"> |
131 | 112 | <ParameterGroup> |
132 | 113 | <FilePath ParameterType="System.String" Required="true" /> |
133 | 114 | <Search ParameterType="System.String" Required="true" /> |
134 | 115 | <Replace ParameterType="System.String" Required="true" /> |
135 | 116 | </ParameterGroup> |
136 | 117 | <Task> |
137 | | - <Reference Include="System.Core" /> |
138 | 118 | <Using Namespace="System" /> |
139 | 119 | <Using Namespace="System.IO" /> |
140 | 120 | <Using Namespace="System.Text.RegularExpressions" /> |
|
0 commit comments