Skip to content

Commit

Permalink
Use Native AOT
Browse files Browse the repository at this point in the history
  • Loading branch information
dorssel committed Nov 19, 2023
1 parent 29760e4 commit a3422a1
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
9 changes: 8 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ SPDX-License-Identifier: GPL-3.0-only

<!-- Use the latest .NET SDK -->
<!-- This product requires Windows 10 (Windows Server 2019) or higher -->
<TargetFrameworks>net8.0-windows10.0.17763</TargetFrameworks>
<TargetFramework>net8.0-windows10.0.17763</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>

<!-- Use the latest C# language standard -->
<LangVersion>12.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -42,8 +43,14 @@ SPDX-License-Identifier: GPL-3.0-only
<Copyright>Copyright (C) $([System.DateTime]::UtcNow.ToString("yyyy")) $(Company)</Copyright>
</PropertyGroup>

<PropertyGroup Condition="$(Configuration) == 'Release'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild">
<SetTargetFramework>TargetFramework=net6.0</SetTargetFramework>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Installer/Installer.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ SPDX-License-Identifier: GPL-3.0-only
-->
<Project Sdk="WixToolset.Sdk">
<PropertyGroup>
<TargetFrameworks></TargetFrameworks>
<GenerateGitVersionInformation>false</GenerateGitVersionInformation>
<UpdateAssemblyInfo>false</UpdateAssemblyInfo>
<OutputName>usbipd-win</OutputName>
<PublishDir>..\Usbipd\bin\publish</PublishDir>
<PowerShellDir>..\Usbipd.PowerShell\bin\$(Configuration)\netstandard2.0\win</PowerShellDir>
<PowerShellDir>..\Usbipd.PowerShell\bin\$(Configuration)\netstandard2.0</PowerShellDir>
<DefineConstants>PublishDir=$(PublishDir);PowerShellDir=$(PowerShellDir);DriversDir=..\Drivers;Year=$([System.DateTime]::UtcNow.ToString("yyyy"))</DefineConstants>
<!-- Suppress WIX1130: DifxApp Driver is deprecated -->
<SuppressSpecificWarnings>1130</SuppressSpecificWarnings>
Expand Down Expand Up @@ -76,7 +77,6 @@ SPDX-License-Identifier: GPL-3.0-only
<Message Importance="high" Text="Publishing pre-built usbipd-win" />
<RemoveDir Directories="..\Usbipd\bin\publish" />
<MakeDir Directories="..\Usbipd\bin\publish" />
<Exec Command="dotnet publish --nologo --no-restore --no-build --configuration $(Configuration) ..\Usbipd" />
<Exec Command="del /s ..\Usbipd\bin\publish\System.CommandLine.resources.dll" />
<Exec Command="dotnet publish --nologo --no-restore --no-build ..\Usbipd" />
</Target>
</Project>
1 change: 1 addition & 0 deletions NetStandard.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ SPDX-License-Identifier: GPL-3.0-only
<Platforms>AnyCPU</Platforms>
<Platform>AnyCPU</Platform>
<PlatformTarget>AnyCPU</PlatformTarget>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<IsTrimmable>false</IsTrimmable>
</PropertyGroup>
Expand Down
5 changes: 4 additions & 1 deletion Usbipd.Automation/Usbipd.Automation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SPDX-License-Identifier: GPL-3.0-only
<PropertyGroup>
<TargetFrameworks>net8.0-windows10.0.17763;netstandard2.0</TargetFrameworks>
<TargetFramework></TargetFramework>
<IsTrimmable Condition="$(TargetFramework) != 'netstandard2.0'">true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
Expand All @@ -19,7 +20,9 @@ SPDX-License-Identifier: GPL-3.0-only
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\UsbIds\UsbIds.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\UsbIds\UsbIds.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false">
<SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
</ProjectReference>
</ItemGroup>

</Project>
4 changes: 0 additions & 4 deletions Usbipd.PowerShell/Usbipd.PowerShell.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ SPDX-License-Identifier: GPL-3.0-only

<Import Project="..\NetStandard.props" />

<PropertyGroup>
<RuntimeIdentifier>win</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PowerShellStandard.Library">
<PrivateAssets>all</PrivateAssets>
Expand Down
7 changes: 3 additions & 4 deletions Usbipd/Properties/PublishProfiles/InputForInstaller.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ SPDX-License-Identifier: GPL-3.0-only
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0-windows10.0.17763</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishTrimmed>True</PublishTrimmed>
<SelfContained>false</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>
</Project>
9 changes: 8 additions & 1 deletion Usbipd/Usbipd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ SPDX-License-Identifier: GPL-3.0-only
<PropertyGroup>
<OutputType>Exe</OutputType>
<ApplicationManifest>app.manifest</ApplicationManifest>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<IsPublishable>true</IsPublishable>
<PublishProfile>Properties\PublishProfiles\InputForInstaller.pubxml</PublishProfile>
<PublishAot>true</PublishAot>

<AssemblyName>usbipd</AssemblyName>
</PropertyGroup>
Expand Down Expand Up @@ -42,4 +42,11 @@ SPDX-License-Identifier: GPL-3.0-only
</None>
</ItemGroup>

<Target Name="RemoveTranslations" BeforeTargets="Build">
<ItemGroup>
<Translations Include="$(OutputPath)\**\System.CommandLine.resources.dll"/>
</ItemGroup>
<RemoveDir Directories="@(Translations->DirectoryName())" />
</Target>

</Project>

0 comments on commit a3422a1

Please sign in to comment.