Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to package .NET Core 3 in Visual Studio Installer Project

So, I want to create an installer for my .NET Core 3 based C# project. I installed the Installer Projects extension for Visual Studio 2019 and created a new Installer project within my solution. After some trying around with different settings, I ended up with adding PublishItemsOutputGroup for my two executables to the Application Folder. This (throwing various warnings for duplicate dlls) creates a nice installer package with "supposedly" all required dlls (there are quite a lot of .net libs). However, upon executing one of the installed exe files on a target computer, I am getting:

It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '3.0.0' was not found.
  - Check application dependencies and target a framework version installed at:
      C:\Program Files\dotnet
  - Installing .NET Core prerequisites might help resolve this problem:
      https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
  - The .NET Core framework and SDK can be installed from:
      https://aka.ms/dotnet-download
  - The following versions are installed:
      2.2.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

I know, I could create a gigantic self-contained .exe when publishing the .exe files, however, that seems kind of wasteful to me - creating two gigantic .exe files that contain mostly the same .dlls anyways.

Is there no way to include a .NET Core 3 setup in the installer project as well? I can't find anything on that topic on the internet...

like image 959
Andreas P. Avatar asked Nov 18 '19 12:11

Andreas P.


People also ask

How do I use Visual Studio Installer project?

From Visual Studio, choose Extensions > Manage Extensions, and search for "Visual Studio Installer Projects". Or, download the extension directly from the Marketplace. From the Start window, choose Create a new project, and then type "setup" in the search box. Choose a Setup project, and follow instructions.

How do I get .NET core in Visual Studio?

NET Core can be installed in two ways: By installing Visual Studio 2017/2019 or by installing . NET Core Runtime or SDK. . NET Core installer already contains ASP.NET Core libraries, so there is no separate installer for ASP.NET Core.

How do I publish a .NET core 3.1 application?

Published your ASP.NET Core Web API as FDD So open Visual Studio and Go to File -> New -> Project. Select ASP.NET Core Web Application and click on Next. Give the proper name to your project and click on Create.


1 Answers

I found this as had same problem, but eventually worked out if you set the publishProfilePath setting in the Installer Project it will include all the files and works fine.

like image 81
user1012525 Avatar answered Oct 07 '22 06:10

user1012525