Why WPF project after build will make Myapp.exe and Myapp.dll?

兰树豪 381 Reputation points
2022-08-10T17:45:25.917+00:00

Why WPF project after build will make Myapp.exe and Myapp.dll? using net 6.0 will do like I said, but if using NetFramwork 4.8 will only make Myapp.exe , not any dll.
230066-image.png

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,671 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,243 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 55,686 Reputation points
    2022-08-10T19:02:03.747+00:00

    unlike the old framework, .net core did not update the operating system to directly host .net core applications. the build process creates a small exe (c/c++ app) that can host the .net core application (dll). in early versions this was just a script that used dotnet to run the app, but now its a small exe named after the app. typically deployment is a folder from which you run the exe.

    note: with net 6 the build can create a single file exe.

    • on windows the publish creates an exe which when run, create a temp folder to extract the self contained files to, then runs the extracted exe. If temp folder already exists, it just runs the exe
    • on MacOs (which has support for application bundles) it builds an application bundle that does not require any extraction process.
    • on linux I believe it creates a self extracting tar file.
    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Lex Li (Microsoft) 4,742 Reputation points Microsoft Employee
    2022-08-12T06:02:36.403+00:00

    Actually documented clearly in https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-framework-dependent

    "Publishing an app as framework-dependent produces a cross-platform binary as a dll file, and a platform-specific executable that targets your current platform. The dll is cross-platform while the executable isn't. For example, if you publish an app named word_reader and target Windows, a word_reader.exe executable is created along with word_reader.dll. When targeting Linux or macOS, a word_reader executable is created along with word_reader.dll."

    0 comments No comments