-
Notifications
You must be signed in to change notification settings - Fork 5k
Create native host for application with only runtime installed #103746
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
Comments
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov |
Note that the dotnet CLI commands, including
There's no "command in CLI" at all without SDK installed. It's also questionable to produce executable files without SDK.
Generating executable files is not as simple as you may think. Currently, generating the most-correct executable requires running SDK on the same platform. It's even not perfect to do cross-publish. See dotnet/sdk#3943 dotnet/sdk#34917. There are many issues like native resource processing and code signing/notarization. |
Other things to consider:
|
That‘s helpful, thx. Is there any similar interface available without SDK? While currently I'm planing to make a console app as a host-creation-tool which depending on something like Microsoft.NET.HostModel and AppHost(with .exe on windows) just like what CreateAppHost task do. But the native host I'm going to implement is almost the same thing as AppHost in the runtime. But if depending on Microsoft.NET.HostModel directly the console app would need to include the AppHost template for different OS and instruction set, which is already included in SDK for every platform. On linux distributions like debian/centos, I could simply pack the host-creation-tool as a deb/rpm and make it depend on dotnet-apphost-pack-[major].[minor] to include AppHost template, but I'm not sure would there be any similar package on any other platform.
Currently I'm not familiar about things related to anti-various, but I believe there would not be too much difference between using dotnet(.exe) and using another native host.
Script could be executed automatically during installation in many application/package manager. Even without the support of application/package manager embeding a command into installation process should not be complicated. |
So you are requesting as subset of SDK that's necessary to build native host, without bringing full SDK.
When creating packages for installers, you are already creating platform dependent content. It's easy to access SDKs on the machine that creates packages.
Executable files are much more platform-dependent and risky. |
Right. And native code of that subset is actually maintained under /src/native/corehost/ in the runtime repo.
I don't think so. Operating systems like linux/bsd might run on machines with instruction set that was not included during building. And it's not necessary publishing application multiple times for every platform including a native entry. That's the reason I'm planing to implement the host-creation-tool.
I agree. So I feel it's better including AppHost in release of runtime rather than only including it in SDK. Then it will be easy to include nuget package Microsoft.NET.HostModel and implement a tool(a console/commandline tool or anything else) generating native host for applications on any platform with runtime installed. |
The architecture doesn't need to match for publishing. You can publish for win-arm64 on win-x64 for sure.
It is often very necessary, if you want to enable optimizations like R2R or trimming, or native AOT publishing. Native dependencies will also be re-organized during publishing.
It does not change the risk to do these on end user's machine. The app host templates are available as NuGet packages |
Currently we need to build or publish multiple times to generate native host for each target platform, which is not convinient. I discovered that CLI command 'dotnet tool install' would generate a current platform native host for tools installed using AppHost template for current platform. Is there any chance to support generate native AppHost with only Runtime installed by run a command in CLI.
For example, run command
dotnet create-host <path to app.dll>
to generate native host for specific application.It would be simple to build/ship application running on multi-platform. Developers could simply build and publish application without native host and just run same command during installation on any platform with dotnet runtime installed.
The text was updated successfully, but these errors were encountered: