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

我是研究僧i 提交于 2019-12-06 20:21:06

问题


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?


回答1:


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



回答2:


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.




回答3:


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:

  • .NET Debugging labs

Also use this:

  • WinDBG Cheat Sheet



回答4:


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!




回答5:


(JaredPar) answer looks right (x64), but if not try right clicking on the EXE and running in admin mode for win 7.




回答6:


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.




回答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.




回答8:


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 .



来源:https://stackoverflow.com/questions/4206941/wpf-dotnet-application-will-run-in-debug-mode-but-exe-will-not-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!