1

I am writing an application in C# with Visual Studio 2010 and am close to the end with engineering of my application. For testing i use 3 different machines:

Machine A: Workstation-PC (Intel CPU, Win 7 64Bit, .NET 4.0)

Machine B: Private PC (Intel CPU, Win7 64Bit, .NET 4.0)

Machine C: Labor-PC (AMD64, Win7 64Bit, .NET 4.0)

I want a standalone .exe file for the final version. The application works like a charm on Machines A and B no matter if i run the application in the solution folder or copy it to any directory and run it there. It works always (as it should). But Machine C throws an error, directly on application startup and outputs a "...WERInternalMetadata.xml"-file which says "System.IO.FileNotFoundException":

CLR20r3 myapp.exe 1.0.0.0 53318d78 Testreporter 1.0.0.0 53318d78 5d f System.IO.FileNotFoundException

But when I start the application in the solution folder(e.g. ...myapp\bin\x64\Debug), where the *.dll files are contained, the application works perfectly without any problems. Does this mean, that the program searches for its dependecies in the root directory?

I've already checked the references in code. Furthermore if there were any problems with references, the app would not run on Machine B...

I find it curious that Machines A and B run the program without issues no matter where i place the .exe but Machine C only runs my app properly when placed in specific path....

Maybe the processor plays a role there? Any ideas on how to solve this?

BTW: How can i build a .exe-file that already contains all dependencies and libraries my application needs. A standalone-exe so to say...

Thank you very much

leppie
  • 109,129
  • 16
  • 185
  • 292

3 Answers3

0

It looks like the EXE is able to find the necessary DLLs in GAC on machines A and B, but is failing to do so in Machine C. Hence, only the particular path is working.

Please check the GAC.

Also, to embed DLLs into EXEs, refer to this SO thread: Embedding DLLs in a compiled executable

Community
  • 1
  • 1
Raja Nadar
  • 9,006
  • 2
  • 28
  • 39
  • Yes, you may be right. See my answer below. I guess i should check the GAC then. – user3443859 Mar 28 '14 at 12:35
  • This lead me to the solution: http://stackoverflow.com/questions/21627042/system-io-filenotfoundexception-where-do-i-find-what-path-is-wrong?rq=1 Detailed answer follows as soon as possible.... – user3443859 Mar 28 '14 at 12:52
0

I've found a thread with similar topic, leading me to the solution:

System.IO.FileNotFoundException. Where do I find what path is wrong?

I am using Power Packs, too. When i removed the "Microsoft.VisualBasic.PowerPacks.Vs.dll" from the solution directory and started the application, my program failed with the descripted error. Copying back, then starting the application again was successful. So I guess my the target machine (machine C) needs a Power Pack Installation.

So I guess I can solve this problem in 4 ways?:

1.) Leaving the "Microsoft.VisualBasic.PowerPacks.Vs.dll" with the .exe in same folder and then start my application.

2.) Installing the PowerPack http://go.microsoft.com/fwlink/?LinkID=145727&clcid=0x804

3.) Installing the PowerPack.dll manually to the GAC. Or getting them to the GAC with the corresponding tools as described here http://msdn.microsoft.com/en-us/library/yf1d93sz%28v=vs.110%29.aspx

4.) Embed the .dll right into the .exe

Am I right?

Thank you very much for your help!

Community
  • 1
  • 1
0

I had this problem also, with similar entries in Windows->Application logs, including FileNotFoundException. Very disappointed that every app log clue was just a rabbit hole (lack of specific info on WHAT file). I eventually discovered the error of my wicked ways via Procmon.exe, and scanning through every line marked "NOT FOUND" in the Result column. There was a companion DLL generated as part of the project that I'd forgotten to copy over to the target machine. If Procmon.exe ever disappears I'll be dead. It has helped to resolve probably 90% of subtle issues encountered since I began using VisualStudio in 1998. Gave myself a "BoneHead of The Day" award...