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

Add support for .NET 6 and trimming #188

Merged
merged 3 commits into from
Jul 11, 2021
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
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,10 @@
<UseSharedCompilation>true</UseSharedCompilation>
</PropertyGroup>

<PropertyGroup Condition="'$(OutputType)' == 'Exe'">
<PublishTrimmed>true</PublishTrimmed>
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
<TrimMode>link</TrimMode>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion samples/DirectX/TerraFX.Samples.DirectX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/WinForms/TerraFX.Samples.WinForms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFrameworks>net5.0-windows;net6.0-windows</TargetFrameworks>
<OutputType>WinExe</OutputType>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ try {
Create-Directory -Path $DotNetInstallDirectory

& $DotNetInstallScript -Channel 5.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture
& $DotNetInstallScript -Channel 6.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture

$env:PATH="$DotNetInstallDirectory;$env:PATH"
}
Expand Down
1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ if [[ ! -z "$architecture" ]]; then
CreateDirectory "$DotNetInstallDirectory"

. "$DotNetInstallScript" --channel 5.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture"
. "$DotNetInstallScript" --channel 6.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture"

PATH="$DotNetInstallDirectory:$PATH:"
fi
Expand Down
8 changes: 8 additions & 0 deletions sources/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@

<PropertyGroup>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.props</MSBuildAllProjects>
<TerraFXProjectCategory>sources</TerraFXProjectCategory>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />

<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>IsTrimmable</_Parameter1>
<_Parameter2>True</_Parameter2>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="$(MSBuildProjectName).UnitTests" Key="$(AssemblyOriginatorPublicKey)" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion sources/Interop/Windows/TerraFX.Interop.Windows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<NoWarn>1573;1591;$(NoWarn)</NoWarn>
<RootNamespace>TerraFX.Interop</RootNamespace>
<TargetFramework>net5.0</TargetFramework>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<PropertyGroup>
<RootNamespace>TerraFX.Interop.UnitTests</RootNamespace>
<TargetFramework>net5.0</TargetFramework>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down