Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pdb generation #588

Merged
merged 6 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions Harmony/Harmony.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<Configurations>DebugThin;DebugFat;ReleaseThin;ReleaseFat</Configurations>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<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,10 +59,18 @@
<DefineConstants>DEBUG</DefineConstants>
</PropertyGroup>

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

<PropertyGroup Condition="'$(Configuration)'=='ReleaseFat'">
<Optimize>true</Optimize>
<DebugType>portable</DebugType>
<DebugSymbols>false</DebugSymbols>
<DebugSymbols>true</DebugSymbols>
<ILRepackTargetsFile>$(SolutionDir)ILRepack.targets</ILRepackTargetsFile>
<ClearOutputDirectory>True</ClearOutputDirectory>
</PropertyGroup>
Expand Down Expand Up @@ -93,9 +101,9 @@
</PropertyGroup>
<ItemGroup Condition="$(TargetFramework)=='netstandard2.0'">
<!-- Adding System.Reflection.Emit.* because there are public types exposed from its's package -->
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" IncludeAssets="compile" />
<PackageReference Include="System.Reflection.Emit.ILGeneration" Version="4.7.0" IncludeAssets="compile" />
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" IncludeAssets="compile" />
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" IncludeAssets="compile" />
<PackageReference Include="System.Reflection.Emit.ILGeneration" Version="4.7.0" PrivateAssets="all" IncludeAssets="compile" />
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" PrivateAssets="all" IncludeAssets="compile" />
</ItemGroup>
<Target Name="AddRefAssemblyToPackage" Condition="$(TargetFramework)=='netstandard2.0'">
<ItemGroup>
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