6

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...

Andreas P.
  • 115
  • 2
  • 9
  • I know you've opted for Powershell, but here are the official instructions for others: https://techcommunity.microsoft.com/t5/windows-dev-appconsult/packaging-a-net-core-3-0-application-with-msix/ba-p/386432 – Jeremy Thompson Nov 04 '20 at 06:41

2 Answers2

1

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.

user1012525
  • 128
  • 1
  • 11
  • I actually already abandoned the idea of using installers and instead created a PowerShell script to zip up everything needed as my tries of getting this to work went nowhere. Tried your suggestion, but unfortunately still the same old problem ... thus, gonna stick with my PS script. Thanks for trying to help! – Andreas P. Feb 13 '20 at 21:03
  • i'm interested, no more information since you tried ? – Vonkel. Apr 27 '20 at 10:32
  • Would someone be able to explain how to set the publishProfilePath? What should we set it to? Thanks. – MontanaMan Apr 04 '22 at 01:01
  • Hi! Andreas P., would you care to share your PS script? – NKAT May 19 '22 at 21:41
1

For me replacing PrimaryOutput with PublishItemsOutputGroup works fine, when it comes to gathering the dependencies. Unfortunately it does not allow referencing those outputs inside the installer. E.g. if you want to run custom actions or create Shortcuts during the installation, it does not work. The outputs are not available.

Daniel
  • 597
  • 11
  • 19