Run WPF application (.NET 5) outside Visual Studio

Jalza 781 Reputation points
2021-10-07T15:09:19.277+00:00

I developed a desktop application using WPF and .NET 5. If I run it from Visual Studio 2019, everything works without problems.

My app uses a library to manage video cameras (it is added as an Assembly) and 3 nuget packages (MvvmLightStd10, Newtonsoft.Json and System.Drawing.Common).

Now I need to deploy the application on another computer as an .exe file. I follow these steps:

  • Right click on project.
  • Select Publish.
  • Folder > Next > Folder.
  • I set the location I want to use.
  • Click on Finish button.
  • Click on Show all settings in the new profile

I chose this configuration:

138584-publish-profile.png

After publish, I get the .exe file, it's .pdb file and library's (video cameras) .xml file in the specified folder.

If I double click on .exe file the application runs, but the window is not displayed. I know the application runs because I create a default setting JSON file at start, and it is created.

There is no error messages, so I don't know what is happening. Do you have any idea?

Developer technologies | .NET | .NET Runtime
Developer technologies | C#
{count} votes

1 answer

Sort by: Most helpful
  1. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    2021-10-07T15:23:59.287+00:00

    Consider Application.DispatcherUnhandledException Event and write to a log file. If you need an idea on how to log see my repo.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.