Search code examples
c#.netdeployment.net-7.0

Possible to ship my application with a local copy of the .NET 7 runtime?


Having a set of multiple .NET 7 applications (Console and WinForms) that all sit in the same folder of a product of mine, I try to find a way to deploy it.

Ideally I do not want the .NET 7 Desktop runtime to be installed as a prerequisite condition. I also do not want to publish every of my multiple .NET applications as "Self-contained", since this would enlarge the whole product deployment package as everyone of the several applications has its own copy of .NET 7.

My ideal solution would be to have all my .NET applications sit in one folder and additionally have the full .NET Desktop runtime and all of its files also sit in that very same folder so that all my .NET applications do use this local copy of the .NET Desktop runtime.

I've read through ".NET application publishing overview" but still found no way to do this.

My question

Is it possible to "side-by-side" deploy the .NET 7 runtime together with my application(s)?

Edit 1

I wasn't fully aware that "Self-contained" and "Produce single file" are two independent switches.

Thanks to Bron Davies' answer I now am.

I do think turning "Self-contained" on but leaving "Produce single file" off for one of my multiple applications could be sufficient to serve as the runtime for all of my distinct applications in the final folder.

Edit 2

I've asked the question over at GitHub.com and there are several additional answers to those here, maybe someone reading it here might also be interested in the Q&A over there.


Solution

  • There is an extensive discussion on this topic here: https://github.com/dotnet/runtime/issues/3453

    and here: https://github.com/dotnet/runtime/issues/53834

    Unfortunately it pretty much ends up with the answer that it's not currently possible but with some attention to the issue (i.e. upvotes), a solution might be developed.