Home > Mobile >  Which files do I need to distribute from a C# build?
Which files do I need to distribute from a C# build?

Time:01-10

When I build a C# application project named MyApplication with .NET 6.0 on Windows, I get the following files:

MyApplication.dll
MyApplication.exe
MyApplication.deps.json
MyApplication.dll.config
MyApplication.pdb
MyApplication.runtimeconfig.json
MyApplication.xml

Which of these files do I need to distribute?

MyApplication.dll contains the IL code of the application. I certainly need this one.

MyApplication.exe is the stub loader that starts the application. I do need this.

MyApplication.pdb contains the debug info. I don't need to distribute this.

But what about the others? They seem to contain some dependency information. But is that only required for the compiler, or is it required later at runtime? (My application consists of dozens of dll's).

CodePudding user response:

From the spec of runtime configuration files

  • MyApp.dll - The managed assembly for MyApp, including an ECMA-compliant entry point token.
  • MyApp.exe - A copy of the corehost.exe executable.
  • MyApp.runtimeconfig.json - An optional configuration file containing runtime configuration settings.
  • MyApp.deps.json - A list of dependencies, as well as compilation context data and compilation dependencies. Not technically required, but required to use the servicing or package cache/shared package install features.

So while the json files are not strictly required, I would probably recommend including them.

The MyApplication.xml is an optional documentation file that contains comments for your dll. This is probably not needed if you are distributing an application and not a library, and there should be an option to turn of the generation of this file in your project properties.

You should also check the documentation for Deploying your application. I would especially consider the parts about self contained and single file publishing.

  • Related