简体   繁体   中英

WPF DotNET Application will run in debug mode, but .EXE will not run

I wrote a WPF application in C# using VS 2010. The application will run fine in debug mode using Visual Studio, but when I go to run the.EXE from the bin\release folder, nothing happens. I do not get any error messages from windows and there are no errors or warnings in VS. I have tried to build, rebuild and clean the solution (in every possible order) with no luck. My solution contains 2 projects, both of which use .NET 4.0 framework, and I have .NET 4.0 installed on my PC. I have tried on both XP and Win7 and still nothing.

I also just noticed that the output from Debug when I run the application in debug mode says: "Cannot find or open the PDB file" after each.Dll it loads.

I am compiling to the Release folder every time, but i did try changing it to the debug folder and clean/rebuild just to see if that would make a difference, and it didnt, so I changed it back, tried it again, and still nothing.

Any Ideas?

Here are a couple of ideas that come to mind

  • If you are on a x64 machine, try changing the application from being AnyCPU to x86. This the mode that applications default to in debug mode and it's possible an issue running in x64 is causing a problem in release builds
  • Possible the Release binaries are out of date. Delete the binaries from the Release folder, rebuild and run the newly generated runs
  • Run the release build under the debugger in Visual Studio and see if it till crashes

I was experiencing the above issue too, however none of the other solutions worked for me.

My Application logs in Event Viewer listed event ids 1018 and 1022. This appeared to be bizarrely related to an ASP.NET 2.0 dll (bizarre; as this was a blank WPF project only). The logs contained messages like this:

Windows cannot open the 64-bit extensible counter DLL ASP.NET_64_2.0.50727 in a 32-bit environment

In the end it turned out to be resolved when I disabled my anti-virus . I had read that this resolution worked for someone with McAfee; and it also worked for my environment, which has Avast.

I assume you tried on a machine that doesn't have visual studio installed, and also none of the components you are using for development.

You have only one option: start the application with a debugger on the machine that causes problems and check for exceptions there. (use WinDBG for example - it's light and easy).

This looks like a problem with missing dependencies, but might be something else also.

The Debugging Labs should give you enough information on how to use windbg to find your problem:

Also use this:

I had a very similar issue.

Check out this setting on your App Pool entry:

  • Go to Advanced Settings.
  • Change 'Enable 32-bit Applications' to 'TRUE'.

This worked for me!

(JaredPar)回答看起来正确(x64),但如果没有尝试右键单击EXE并在管理模式下运行win 7。

I had run into a similar issue, I was missing a custom folder in the release mode I was referencing in the constructor. Adding the folder to the release fixed the problem.

I'm going to go with a wild guess that:

  • Either you have some odd corruption in your .NET Framework installation
  • There is some debug/release-specific code using #if DEBUG or the such that is substantially different to cause issues.
  • You have not compiled recently into Release yet (Try changing it to Release before compiling your latest code and make sure you get no errors).

Those are the only things I can think of off the top of my head.

Same problem .
Solved by adding missing dlls to the new folder path of the exe file.
In My case some nuget dlls of WindowsApiCodePack and a class dll which was in the solution .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM