Share via

Deployment WPF as self contained

Dani_S 4,401 Reputation points
Apr 2, 2025, 3:00 PM

Hi,

I used visual studio 17.3.4.

I published WPF app as self contained in .NET 9 to folder , the publish process succeeded.

But the generating exe is not running ? Why?

How it can be solved ?

Thanks,

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,852 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Hongrui Yu-MSFT 5,170 Reputation points Microsoft External Staff
    Apr 3, 2025, 2:37 AM

    Hi, @Dani_S. Welcome to Microsoft Q&A.

    Please troubleshoot the problem from the following aspects

    1. Make sure that your program could run normally in Debug mode.
    2. Make sure that the deployed project does not lack any dependencies. If you use ExcludeFromSingleFile when publishing, make sure that the necessary dependencies are not missing.
    3. If you specify the runtime environment through RuntimeIdentifier, make sure that the project runs in the specified environment. The target machine may not have the .NET runtime environment suitable for running the application installed. You could check whether the runtime environment is complete by running the dotnet --info command on the target machine.
    4. Permission issue: The target machine may have limited execution permissions for the exe file, resulting in failure to run.
    5. You could view the log to see the specific reason why the project cannot run, such as through Event Viewer or writing a run log to see the real reason for the failure.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


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.