Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

dotnet-campus/dotnetCampus.AppHost

Repository files navigation

dotnetCampus.AppHost

Build NuGet

Starting with .NET 9, the official team has introduced the AppHostRelativeDotNet mechanism, which fully encompasses all the functionality provided by this library. For more details, please refer to: dotnet/runtime#64430

After upgrading to .NET 9, you can modify your .csproj file as shown in the example below to enable support for locating the .NET runtime via relative paths:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <AppHostDotNetSearch>AppRelative;Global;</AppHostDotNetSearch>
    <AppHostRelativeDotNet>../relative/path/to/runtime</AppHostRelativeDotNet>
  </PropertyGroup>

</Project>

Note: After publishing your application, you will need to place the .NET runtime files in a folder located at ../relative/path/to/runtime. You can extract these runtime files from the .NET SDK, locate them in your NuGet package cache, or download and unzip the runtime files from the official .NET website.

Since all features of this repository have been integrated into .NET 9, this repository will be archived.


在 dotnet 9 时,官方已经添加了 AppHostRelativeDotNet 机制,完全包含了本库提供的所有功能。详细请参阅:dotnet/runtime#64430

更新到 .NET 9 之后,可更改 csproj 代码为如下示例内容,从而获取寻找相对路径的 dotnet runtime 能力

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <AppHostDotNetSearch>AppRelative;Global;</AppHostDotNetSearch>
    <AppHostRelativeDotNet>../relative/path/to/runtime</AppHostRelativeDotNet>
  </PropertyGroup>

</Project>

注: 你需要在发布之后,在相对路径为 ../relative/path/to/runtime 的文件夹里放入 dotnet runtime 的文件。你可以从 dotnet SDK 里面提取 dotnet runtime 的文件,或者从你的 NuGet 包缓存里面查找,或者从 dotnet 官方下载运行时 zip 包解压缩

详细请参阅 dotnet 9 通过 AppHostRelativeDotNet 指定自定义的运行时路径

由于本代码仓库所有功能已经被 .NET 9 引入,本仓库将归档

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •  

Languages