-1

When I release my application, I get a lot of XML files (i.e. Prism.wpf.xml, Prism.xml, system.runtime.compilerservices.unsafe.xml, projectname.exe.config) together with the actual .exe file.

Initially, I installed Costura to embed the .dll files in the .exe file. this worked like a charm.

My question is therefore, how do I embed these .xml dependencies?

Avacay
  • 153
  • 1
  • 13
  • These aren't dependencies per-se, but usually just Intellisense information, which you probably don't need to deploy. Maybe this helps as well: https://stackoverflow.com/questions/2011434/preventing-referenced-assembly-pdb-and-xml-files-copied-to-output – Lennart Oct 10 '19 at 09:05
  • Aha! So what about the config file? Can i just delete that too? – Avacay Oct 10 '19 at 09:08
  • @Avacay depends what's in it. If it's got things like binding redirects, or logging configuration, or you've added your own settings, or you care about the application being able to run on a different .NET Framework version to the one it was built with, etc, then you'll need it. If you don't care about any of those things, you can probably do without. Any moderately complex application usually needs its app.config in my experience. – canton7 Oct 10 '19 at 09:11
  • Note that you can deploy single-file executables with .NET Core 3.0, without having to mess around with things like Costura (although the WPF experience on .NET Core 3.0 isn't yet as slick as it is on .NET Framework) – canton7 Oct 10 '19 at 09:12

1 Answers1

0

As mentioned in the comments, the XML files can safely be removed.

If you want to deploy only a single executable (.exe) file with all dependencies included, you should look into targeting .NET Core 3 and publish your app using the PublishSingleFile option:

dotnet publish -r win10-x86 -c release /p:PublishSingleFile=true

Please refer to this blog post for more information.

There is no officially supported way to create a single-file WPF .exe using the .NET Framework.

mm8
  • 163,881
  • 10
  • 57
  • 88