6

I've got a WPF project that I am trying to publish without any form of installer. Basically I want the program compiled in a directory with all the necessary files next to it, so that I can zip everything and deploy the program on clients.

Ideally I will want to have all external resources compiled in the EXE.

Is there any way to do that? If I go in the debug/bin folder, on my workstation, I can execute the EXE but if I zip it along with the DLL and try to do that on another machine it crashes, probably missing a file is my guess. (if I publish with the installer it works though but that is not suitable for this project).

thanks Steve

edit: When I execute the program (which I copied from the Bin directory after a successufull build), nothing happens, just the message the "program has stopped working". My program uses 3 external files, an icon, an image and a font. I have a DLL (WPFtoolkit) referenced, I added that DLL to a directory in my solution explorer. All files are Set to Embedded Resource, and "Do not copy". I also added this code to my program, still the same error. http://codeblog.larsholm.net/2011/06/embed-dlls-easily-in-a-net-assembly/ the size of my EXE is correct, I can see that the DLL has been "added" to it. still the program only works on my workstation :(

edit:

Should I keep the DLL in the references? My guess is no, but if I do that, I get an error when I call my:

using Microsoft.Windows.Controls;

if I don't call it, the program compiles but crashes. see error message below:

Problem signature:
  Problem Event Name:   CLR20r3
  Problem Signature 01: sw imperium.exe
  Problem Signature 02: 1.0.0.0
  Problem Signature 03: 53bdd468
  Problem Signature 04: PresentationFramework
  Problem Signature 05: 4.0.30319.18408
  Problem Signature 06: 52312f13
  Problem Signature 07: a19
  Problem Signature 08: 46
  Problem Signature 09: System.Windows.Markup.XamlParse
  OS Version:   6.1.7601.2.1.0.256.1
  Locale ID:    1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Mike Beeler
  • 4,081
  • 2
  • 29
  • 44
user3617652
  • 143
  • 2
  • 12
  • **What do you mean by *crash*? The actual error message may help to diagnose**. Are you trying to run the executable directly from the zip? Does the target computer has the correct .Net framework set up? – Steve B Jul 09 '14 at 22:32
  • Yes, the client has .NET installed. When I execute the program, nothing happens, just the message the "program has stopped working". My program uses 3 external files, an icon, an image and a font. I have a DLL (WPFtoolkit) referenced, I added that DLL to a directory in my solution explorer. All files are Set to Embedded Resource, and "Do not copy". I also added this code to my program, still the same error. http://codeblog.larsholm.net/2011/06/embed-dlls-easily-in-a-net-assembly/ – user3617652 Jul 09 '14 at 23:25
  • Do you have access to another machine with VS 2013 installed and environment similar to the client? I would try to copy the code on a different machine with the code and then **attach a debugger while you try to execute the application build from your actual machine**. When the application breaks it would then point you to the actual line where it is breaking. – Sandesh Jul 28 '14 at 04:37
  • Can you share your code (or sample code showing your problem) alogwith corresponding x86 binary? You also mentioned Debug\bin folder. Did you try using release build. There has been crashes sometimes on target due to non availability of debug runtime dlls? – Abhinav Jul 30 '14 at 11:48
  • [this SO answer](http://stackoverflow.com/a/1924374/474535) may give you some information for what looks like a similar question – bart s Jul 30 '14 at 12:06

3 Answers3

1

Is the toolkit installed on your PC ( where visual studio is ) in the GAC? All files that are not included in as an imbedded resource should be copy local ( in which case the build will copy those files into the bin folder.

To isolate the problem and get a better error message move the code to a non developer PC and enable the fusion logger to find any assemblies that the loader cannot find.

See this link on more information about the loader (fusion) logger How to enable assembly bind failure logging (Fusion) in .NET

Consider adding some additional error logging code to app startup, see .NET application cannot start and receive XamlParseException

Community
  • 1
  • 1
Mike Beeler
  • 4,081
  • 2
  • 29
  • 44
  • 1
    Yes the toolkit is installed on the developer machine. As I said, if I publish the project, which creates an installer, I can deploy without any problem. It does install fine and the program works just as fine. – user3617652 Jul 10 '14 at 16:58
  • 1
    if the installer is working correctly use the following to extract the files from the installer to see which file you are missing. you should be using an installer in any case. msiexec /a PathToMSIFile /qb TARGETDIR=DirectoryToExtractTo – Mike Beeler Jul 24 '14 at 02:07
1

There is a good tool for merging assembly that supports WPF: .net reactor. You also can try Vitevic Assembly Embedder. Hope this help.

Alex Erygin
  • 3,161
  • 1
  • 22
  • 22
1

You might want to go through this article to see any missing dependencies and profile the application.

PS: If it doesnt helps, try adding more info in the questionlike sample code and/or binary

Abhinav
  • 1,496
  • 3
  • 15
  • 31