Bestije Hitsu
Bestije Hitsu

Reputation: 31

Why I get a DLL installed by the setup project instead of an EXE and how to fix it?

I create a new C# project WPF Application - A project for a .NET Core WPF Application. Framework: .NET Core 3.1.

Project loaded. (you have an empty form) Right click on your project and check that you have "Output type" Windows application. (It means when you click on build it creates an EXE file in BIN folder of your project) Then add a new project to the solution : Setup Wizard by extension Microsoft Visual Studio Installer Projects. Then follow steps as is here -> https://stackoverflow.com/a/6090929/15917420

In the end it packages DLL into installator file instead EXE.

So if you take setup.exe and install it, it installs DLL. Do you have same problem or am I missing something?

If I create WPF with .NET Framework I dont have this problem.

Thank you

EDIT: recorded video: https://drive.google.com/file/d/11ElC0F62klxQOI-beOn6LhcZbyOb7QDT/view?usp=sharing

Upvotes: 2

Views: 3473

Answers (3)

Lisa Bencic
Lisa Bencic

Reputation: 1

Yes, "published items" instead of "primary output" for .net core WinForms solved my problem for the generic Setup Project. You can use "published" as your shortcut and in any other ways it will link to your exe like the "primary output" used to. Note now you have to: 1. Publish your WinForms (I sent mine to a directory but you don't have to indicate that anywhere in the Installer setup) and then 2: Point the Setup to "Published Files" instead of "Primary Output".

Upvotes: 0

mly
mly

Reputation: 101

I had the same issue. Microsoft has published this: https://learn.microsoft.com/en-us/visualstudio/deployment/installer-projects-net-core?view=vs-2019

Basically is says that for .NET Core projects, you have to use the "published items" instead of "primary output" when building the setup project. It also has a couple of other hints too.

Upvotes: 8

PMF
PMF

Reputation: 17248

When targetting .NET Core, the "main" project (the one that is the application) gets two files, a dll and an exe file. The exe file is only a stub loader that locates the dotnet runtime and transfers control to the corresponding dll. Simply put, the exe of a .NET core project is executing the dotnet <dll-with-the-same-name>-command.

With this in mind, you need to make sure that your installer installs both the dll and the exe (and any other similarly named files, such as <Application>.deps.json).

Upvotes: 1

Related Questions