Can't seee ClickOnce error before window closes
I have a ClickOnce cmd line app that is throwing an exception on initialise. I can't see details of the exception because the console window closes before I can see it.
I have tried launching (my using the shortcut from the start menu, simply dropping it on to the console window) but it launches a separate console, writes the error to that and closes!
How can I see the error开发者_如何学C?!
Thanks
Ryan
I recommend tracking down the executable in the ClickOnce cache and double-clicking on it to see if it's a ClickOnce problem or a problem in your application.
The cache is in C:\Users\username\AppData\Local\Apps\2.0\obfuscatedfolder\obfuscatedfolder and from there you'll have to look in the folders for the one with your exe in it.
If it works, then it's a bug in your app. I'd put some messageboxes or logging in your app, or put in a try-catch around the start routine and have it show the exception and prompt the user for input in order to continue.
If it doesn't work, I would install .NET 4 on the machine and enable the enhanced ClickOnce logging and then check out the log file. (Note: The app does not have to target .NET 4, it just has to be installed on the machine.) Here's an article on how to enable enhanced logging for a ClickOnce application.
Here is a little quick & dirty solution:
Use a .bat file.
In the first line launch the shortcut, the second line is just a pause.
start shortcut_name
pause
Here is good link if you're not familiar using with .bat files
精彩评论