Skip to content

Commit

Permalink
支持 .NET 9 SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
walterlv committed Nov 18, 2024
1 parent 203097e commit 5e814df
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net6.0-windows;net45</TargetFrameworks>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<IsPackable>false</IsPackable>
Expand All @@ -16,7 +16,7 @@
</PropertyGroup>

<PropertyGroup>
<DCAppHostPatcherToolPath>$(MSBuildProjectDirectory)\..\..\src\dotnetCampus.AppHost\bin\$(Configuration)\net6.0\dotnetCampus.AppHost.dll</DCAppHostPatcherToolPath>
<DCAppHostPatcherToolPath>$(MSBuildProjectDirectory)\..\..\src\dotnetCampus.AppHost\bin\$(Configuration)\net8.0\dotnetCampus.AppHost.dll</DCAppHostPatcherToolPath>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/dotnetCampus.AppHost/Assets/build/Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
<!-- 暂时还没有支持 net5.0。 -->
<!--<_DCTargetFramework Condition="'$(TargetFramework)'=='net5.0'">net5.0</_DCTargetFramework>-->
<!--<_DCTargetFramework Condition="'$(TargetFramework)'=='net5.0-windows'">net5.0</_DCTargetFramework>-->
<CreateCustomAppHostDependsOn>_ChooseAppHost</CreateCustomAppHostDependsOn>
<CreateCustomAppHostDependsOn Condition="$([MSBuild]::VersionGreaterThanOrEquals($(NETCoreSdkVersion), 9.0))">_GetAppHostPaths</CreateCustomAppHostDependsOn>
</PropertyGroup>

<Target Name="CreateCustomAppHost" BeforeTargets="_CreateAppHost" DependsOnTargets="_ChooseAppHost">
<Target Name="CreateCustomAppHost" BeforeTargets="_CreateAppHost" DependsOnTargets="$(CreateCustomAppHostDependsOn)">

<PropertyGroup>
<_DCAppHostRoot>$(MSBuildThisFileDirectory)..\</_DCAppHostRoot>
Expand Down Expand Up @@ -90,4 +92,4 @@ AppHostNeedSystemPrereqsUrl = $(AppHostNeedSystemPrereqsUrl) &lt;系统

</Target>

</Project>
</Project>
2 changes: 1 addition & 1 deletion src/dotnetCampus.AppHost/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !NET6_0
#if !NET8_0
internal static class Program
{
private static void Main()
Expand Down
10 changes: 7 additions & 3 deletions src/dotnetCampus.AppHost/dotnetCampus.AppHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net6.0;net5.0;netstandard2.0;net45</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.0;net45</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RootNamespace>dotnetCampus.AppHosting</RootNamespace>
Expand Down Expand Up @@ -30,13 +30,17 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="dotnetCampus.CommandLine.Source" Version="3.3.0" PrivateAssets="All" />
<PackageReference Include="dotnetCampus.Configurations.Source" Version="1.6.8" PrivateAssets="All" />
<PackageReference Include="dotnetCampus.MSBuildUtils.Source" Version="1.1.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net8.0'">
<Compile Remove="**\*.cs" />
<Compile Include="Program.cs" />
</ItemGroup>
Expand Down

0 comments on commit 5e814df

Please sign in to comment.