|
1 | 1 | <Project Sdk="Microsoft.NET.Sdk"> |
2 | 2 |
|
3 | | - <PropertyGroup> |
4 | | - <TargetFrameworks>net452</TargetFrameworks> |
5 | | - <AssemblyName>CollabUtils2</AssemblyName> |
6 | | - <RootNamespace>Celeste.Mod.CollabUtils2</RootNamespace> |
7 | | - </PropertyGroup> |
8 | | - |
9 | | - <ItemGroup> |
10 | | - <PackageReference Include="MonoMod.RuntimeDetour" Version="22.1.4.3" PrivateAssets="all" ExcludeAssets="runtime"> |
11 | | - <IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
12 | | - </PackageReference> |
13 | | - <PackageReference Include="YamlDotNet" Version="8.1.2" PrivateAssets="all" ExcludeAssets="runtime"> |
14 | | - <IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
15 | | - </PackageReference> |
16 | | - </ItemGroup> |
17 | | - |
18 | | - <ItemGroup> |
19 | | - <Reference Include="CelesteNet.Client"> |
20 | | - <HintPath>lib-stripped\CelesteNet.Client.dll</HintPath> |
21 | | - <Private>false</Private> |
22 | | - </Reference> |
23 | | - <Reference Include="CelesteNet.Shared"> |
24 | | - <HintPath>lib-stripped\CelesteNet.Shared.dll</HintPath> |
25 | | - <Private>false</Private> |
26 | | - </Reference> |
27 | | - </ItemGroup> |
28 | | - |
29 | | - <Choose> |
30 | | - <When Condition="Exists('..\..\Celeste.exe')"> |
31 | | - <ItemGroup> |
32 | | - <Reference Include="Celeste" HintPath="..\..\Celeste.exe" Private="false" /> |
33 | | - <Reference Include="MMHOOK_Celeste" HintPath="..\..\MMHOOK_Celeste.dll" Private="false" /> |
34 | | - </ItemGroup> |
35 | | - |
36 | | - <Choose> |
37 | | - <When Condition="'$(OS)' != 'Windows_NT' Or Exists('..\..\FNA.dll')"> |
38 | | - <ItemGroup> |
39 | | - <Reference Include="FNA" HintPath="..\..\FNA.dll" Private="false" /> |
40 | | - </ItemGroup> |
41 | | - </When> |
42 | | - |
43 | | - <Otherwise> |
44 | | - <ItemGroup> |
45 | | - <Reference Include="Microsoft.Xna.Framework" HintPath="$(WINDIR)\Microsoft.NET\assembly\GAC_32\Microsoft.Xna.Framework\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.dll" Private="false" /> |
46 | | - <Reference Include="Microsoft.Xna.Framework.Game" HintPath="$(WINDIR)\Microsoft.NET\assembly\GAC_32\Microsoft.Xna.Framework.Game\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Game.dll" Private="false" /> |
47 | | - <Reference Include="Microsoft.Xna.Framework.Graphics" HintPath="$(WINDIR)\Microsoft.NET\assembly\GAC_32\Microsoft.Xna.Framework.Graphics\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Graphics.dll" Private="false" /> |
48 | | - </ItemGroup> |
49 | | - </Otherwise> |
50 | | - </Choose> |
51 | | - </When> |
52 | | - |
53 | | - <Otherwise> |
54 | | - <ItemGroup> |
55 | | - <Reference Include="Celeste" HintPath="lib-stripped\Celeste.exe" Private="false" /> |
56 | | - <Reference Include="MMHOOK_Celeste" HintPath="lib-stripped\MMHOOK_Celeste.dll" Private="false" /> |
57 | | - <Reference Include="FNA" HintPath="lib-stripped\FNA.dll" Private="false" /> |
58 | | - </ItemGroup> |
59 | | - </Otherwise> |
60 | | - </Choose> |
| 3 | + <PropertyGroup> |
| 4 | + <TargetFramework>net8.0</TargetFramework> |
| 5 | + <AssemblyName>CollabUtils2</AssemblyName> |
| 6 | + <RootNamespace>Celeste.Mod.CollabUtils2</RootNamespace> |
| 7 | + <LangVersion>preview</LangVersion> |
| 8 | + <CelestePrefix Condition="'$(CelestePrefix)' == '' And Exists('..\..\Celeste.dll')">..\..</CelestePrefix> |
| 9 | + <CelestePrefix Condition="'$(CelestePrefix)' == ''">lib-stripped</CelestePrefix> |
| 10 | + <ZippedFiles>everest.yaml;bin\CollabUtils2.*;Audio\**\*.*;Dialog\**\*.*;Graphics\**\*.*;Ahorn\**\*.*;Loenn\**\*.*</ZippedFiles> |
| 11 | + </PropertyGroup> |
| 12 | + |
| 13 | + <!--Disable "Copy Local" for all references--> |
| 14 | + <ItemDefinitionGroup> |
| 15 | + <PackageReference PrivateAssets="all" ExcludeAssets="runtime" /> |
| 16 | + <Reference Private="false" /> |
| 17 | + </ItemDefinitionGroup> |
| 18 | + |
| 19 | + <ItemGroup> |
| 20 | + <PackageReference Include="MonoMod.RuntimeDetour" Version="25.3.1.0" PrivateAssets="all" ExcludeAssets="runtime" /> |
| 21 | + <PackageReference Include="MonoMod.Patcher" Version="25.0.0-prerelease.2" /> |
| 22 | + <PackageReference Include="CelesteAnalyzer" Version="*" /> |
| 23 | + </ItemGroup> |
| 24 | + |
| 25 | + <ItemGroup> |
| 26 | + <PackageReference Include="CelesteMod.Publicizer" Version="*" CelesteAssembly="$(CelestePrefix)\Celeste.dll" /> |
| 27 | + <Reference Include="$(CelestePrefix)\MMHOOK_Celeste.dll" Private="false" /> |
| 28 | + <Reference Include="$(CelestePrefix)\FNA.dll" Private="false" /> |
| 29 | + |
| 30 | + <Reference Include="lib-stripped\CelesteNet.Client.dll" Private="false" /> |
| 31 | + <Reference Include="lib-stripped\CelesteNet.Shared.dll" Private="false" /> |
| 32 | + |
| 33 | + <PackageReference Include="YamlDotNet" Version="16.0.0.0" /> |
| 34 | + <PackageReference Include="Mono.Cecil" Version="0.11.6.0" /> |
| 35 | + </ItemGroup> |
| 36 | + |
| 37 | + <Target Name="CopyFiles" AfterTargets="Build" Inputs="$(OutputPath)\$(AssemblyName).dll;$(OutputPath)\$(AssemblyName).pdb" Outputs="bin\$(AssemblyName).dll;bin\$(AssemblyName).pdb"> |
| 38 | + <Copy SourceFiles="$(OutputPath)\$(AssemblyName).dll" DestinationFolder="bin" /> |
| 39 | + <Copy SourceFiles="$(OutputPath)\$(AssemblyName).pdb" DestinationFolder="bin" /> |
| 40 | + </Target> |
| 41 | + |
| 42 | + <Target Name="PackageMod" AfterTargets="CopyFiles" Inputs="$(ZippedFiles)" Outputs="CollabUtils2.zip" Condition="'$(Configuration)' == 'Release'"> |
| 43 | + <ItemGroup> |
| 44 | + <FilesToPackage Include="$(ZippedFiles)" /> |
| 45 | + </ItemGroup> |
| 46 | + <PackageMod Files="@(FilesToPackage)" OutputPath="CollabUtils2.zip" /> |
| 47 | + </Target> |
| 48 | + |
| 49 | + <PropertyGroup> |
| 50 | + <PathMap>$(MSBuildProjectDirectory)=CollabUtils2/</PathMap> |
| 51 | + </PropertyGroup> |
| 52 | + |
| 53 | + <!-- Inline task used to create a .zip for the mod --> |
| 54 | + <UsingTask TaskName="PackageMod" |
| 55 | + TaskFactory="RoslynCodeTaskFactory" |
| 56 | + AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" > |
| 57 | + <ParameterGroup> |
| 58 | + <Files ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" /> |
| 59 | + <OutputPath ParameterType="System.String" Required="true" /> |
| 60 | + </ParameterGroup> |
| 61 | + <Task> |
| 62 | + <Using Namespace="System.IO" /> |
| 63 | + <Using Namespace="System.IO.Compression" /> |
| 64 | + <Code Type="Fragment" Language="cs"> |
| 65 | + <![CDATA[ |
| 66 | + var projectDir = @"$(ProjectDir)"; |
| 67 | + projectDir = Uri.UnescapeDataString(projectDir); |
| 68 | +
|
| 69 | + if (File.Exists(OutputPath)) |
| 70 | + File.Delete(OutputPath); |
| 71 | +
|
| 72 | + using (ZipArchive zip = ZipFile.Open(OutputPath, ZipArchiveMode.Create)) |
| 73 | + { |
| 74 | + foreach (var file in Files) |
| 75 | + { |
| 76 | + string filePath = file.GetMetadata("FullPath"); |
| 77 | + string entryName = GetRelativePath(projectDir, filePath); |
| 78 | +
|
| 79 | + zip.CreateEntryFromFile(filePath, entryName); |
| 80 | + } |
| 81 | + } |
| 82 | +
|
| 83 | + string GetRelativePath(string fromPath, string toPath) |
| 84 | + { |
| 85 | + if (string.IsNullOrEmpty(fromPath)) throw new ArgumentNullException(nameof(fromPath)); |
| 86 | + if (string.IsNullOrEmpty(toPath)) throw new ArgumentNullException(nameof(toPath)); |
| 87 | +
|
| 88 | + Uri fromUri = new Uri(fromPath); |
| 89 | + Uri toUri = new Uri(toPath); |
| 90 | +
|
| 91 | + if (fromUri.Scheme != toUri.Scheme) { return toPath; } // path can't be made relative. |
| 92 | +
|
| 93 | + Uri relativeUri = fromUri.MakeRelativeUri(toUri); |
| 94 | + string relativePath = Uri.UnescapeDataString(relativeUri.ToString()); |
| 95 | +
|
| 96 | + if (toUri.Scheme.Equals("file", StringComparison.InvariantCultureIgnoreCase)) |
| 97 | + { |
| 98 | + relativePath = relativePath.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); |
| 99 | + } |
| 100 | +
|
| 101 | + return relativePath; |
| 102 | + } |
| 103 | + ]]> |
| 104 | + </Code> |
| 105 | + </Task> |
| 106 | + </UsingTask> |
61 | 107 |
|
62 | 108 | </Project> |
0 commit comments