dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.72k stars 1.07k forks source link

Extend runtimeconfig.json with preferred dotnet install locations #22505

Open Archieeeeee opened 3 years ago

Archieeeeee commented 3 years ago

Scenarios are common: users can run dotnet apps friendly and no need to care about dotnet runtime.

To figure out what the problem is:

Apps can be deployed in two ways: 1) shared runtime 2) self contained runtime

For the shared solution, if you run the SDK generated exe, it will show user a link to download the runtime,it's very confusing why they should care about things not about the app,and it's worse the user has to choose which runtime to download on the page,desktop runtime or only runtime,arm64 or x86_64, and its even worse the page is not internationalized.

Now you want to check and provide runtime during app setup,the dotnet installer does provide an silent install switch but actually its not,it requires the user has admin privilege. To solve this,you can install dotenet to a different location, now you can use dotnet packaged yourself or the install script officially provided ,but its meaningless,the exe tries to locate dotnet on the default location,you should provide an exe launcher which hacks modifiying dotnet root path and start the exe,the program started but can not pinned to the taskbar because it will not start without the launcher. Btw,the cdn using by the install script is quite slow, 500kBps during my test.

Now you want to build a self contained app,the first problem is you will have tens of dlls with the exe,the user can not find it easily,you have to make a parent folder to make a shortcut. The second problem is the runtime size is big,if you want to reduce the size,you may consider the dotnet assembly trimming,but it's meaningless considering the big advantage of dotnet is at desktop but the desktop framework wpf and winforms do not support trimming while they takes 25 percent of the runtime size.

Thats why we need the extension,let the developer manages to download or provide a runtime,by providing the runtime location in the config file,the exe can be pinned on taskbar,and the file structure is clean,and the user does not need to be admin,and they do not need to know what dotnet runtime is.

dotnet-issue-labeler[bot] commented 3 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.