Skip to content

Commit

Permalink
Added pdb generation
Browse files Browse the repository at this point in the history
* for Thin they are embedded
* for Fat they are portable
  • Loading branch information
Aragas committed Mar 2, 2024
1 parent c419782 commit af400b8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
31 changes: 23 additions & 8 deletions Harmony/Harmony.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
<InformationalVersion>$(HarmonyVersion)$(HarmonyPrerelease)</InformationalVersion>
<NoWarn>$(NoWarn);SYSLIB0011;NU5131</NoWarn>
<Configurations>DebugThin;DebugFat;ReleaseThin;ReleaseFat</Configurations>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<CopyDebugSymbolFilesFromPackages>true</CopyDebugSymbolFilesFromPackages>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net5.0' Or '$(TargetFramework)'=='net6.0' Or '$(TargetFramework)'=='net7.0' Or '$(TargetFramework)'=='net8.0'">
Expand All @@ -59,12 +59,20 @@
<DefineConstants>DEBUG</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='ReleaseThin' Or '$(Configuration)'=='ReleaseFat'">
<PropertyGroup Condition="'$(Configuration)'=='ReleaseThin'">
<Optimize>true</Optimize>
<DebugType>portable</DebugType>
<DebugSymbols>false</DebugSymbols>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
<ILRepackTargetsFile>$(SolutionDir)ILRepack.targets</ILRepackTargetsFile>
<ClearOutputDirectory>True</ClearOutputDirectory>
<ClearOutputDirectory>false</ClearOutputDirectory>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='ReleaseFat'">
<Optimize>true</Optimize>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<ILRepackTargetsFile>$(SolutionDir)ILRepack.targets</ILRepackTargetsFile>
<ClearOutputDirectory>false</ClearOutputDirectory>
</PropertyGroup>

<ItemGroup Condition="'$(Configuration)'=='DebugThin' Or '$(Configuration)'=='ReleaseThin'">
Expand Down Expand Up @@ -138,6 +146,13 @@
<Delete Files="@(OldNugetPackages)" />
</Target>

<Target Name="RemoveFaultyPdb" BeforeTargets="Build">
<ItemGroup>
<FilesToDelete Include="$(ProjectDir)\$(OutDir)\MonoMod.ILHelpers.pdb"/>
</ItemGroup>
<Delete Files="@(FilesToDelete)" />
</Target>

<Target Name="CleanZip" AfterTargets="Clean">
<ItemGroup>
<OldZipFiles Include="$(MSBuildThisFileDirectory)bin\Harmony-Thin.*.zip" Condition="'$(Configuration)'=='ReleaseThin'"/>
Expand Down
5 changes: 5 additions & 0 deletions ILRepack.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="ILRepacker" AfterTargets="Build" Condition="'$(Configuration)' == 'DebugFat' Or '$(Configuration)' == 'ReleaseFat'">
<PropertyGroup>
<DebugInfo Condition="'$(TargetFramework)' == 'netstandard2.0'">false</DebugInfo>
<DebugInfo Condition="'$(TargetFramework)' != 'netstandard2.0'">true</DebugInfo>
</PropertyGroup>
<ItemGroup>
<InputAssemblies Include="$(OutputPath)\*.dll" />
</ItemGroup>
<ILRepack
InputAssemblies="@(InputAssemblies)"
OutputFile="$(OutputPath)\$(AssemblyName).dll"
DebugInfo="$(DebugInfo)"
CopyAttributes="false"
XmlDocumentation="true"
Internalize="true"
Expand Down

0 comments on commit af400b8

Please sign in to comment.