WinForms App Doesn't Run Outside Visual Studio - c#

I'm using Visual Studio 2013, C#, Windows Forms application on a new laptop with Windows 7 Ultimate.
From within VS, if I Build and run my app, it opens fine (no errors or warnings). If go into the debug folder and double click the exe file, the app doesn't open. It appears in task manager, but I can't kill it. I get no error messages. Because it's running, I can no longer Build or run the project from VS as the file is in use.
I tried Building to Release and got the same problem.
The only way to get rid from the task manager is to restart the laptop.
This wasn't a problem on my old PC - which also had Win7 Ultimate and VS2013.
Do you know why my exe isn't running and why I can't kill it in Task Manager? Any help would be appreciated.

I had exactly the same problem. I have VS Express 2015 for Windows Desktop. Recently build app worked only from Visual Studio, old builds work fine. After some research I found that the promblem was my Avast Antivirus 2015, which prevented the new apps from running.
So I suggest, if you have Antivirus running, pause it for a while and see what happens. If indeed that is was the cause for your problems, the configure Antivirus so that it will not check your app when loading.
In Avast: Settings->Active protection->File system protection
(Not sure if that is excatly so, because I have Avast in other language than english)
Hope that works!

I have the same issue with Avast 2015 (licensed) that locks File Explorer up if I double click my c# apps in the bin\debug or release folders.
As others have suggested, rather than disabling Avast "Scan programs while executing" you can add your app path into the scan exclusion list via:
Left click the Avast Icon
Click Settings
Click Active Protection
Click Customize link for "File System Shield"
Click Exclusions and add your build folder. e.g. \bin
Also,
If Windows Explorer has locked up because of this issue, rather than rebooting you can open Task Manager, end-task "Windows Explorer" (your start bar will vanish) then click File->Run new task and type in Explorer, then hit enter to get everything back.
Cheers

Related

Need to restart Visual Studio 2017 for IIS to work

I'm developing a site with .NET and C# in Visual Studio 2017. When I first load the project, I can press the green arrow IIS Express button and it opens a new browser window and everything is fine. However if I stop it or exit from the browser tab, the next time it doesn't load the page. It opens the browser window, but says it cannot connect, and the IIS Express button doesn't stay grey and goes back to white. This started happening only recently, and I've not made considerable changes to the codebase; I don't know why this is happening now.
All I have to do is exit Visual Studio and open it up again, then I can run IIS Express for one time before it stops working again.
I don't see any errors, I've tried running in Administrator mode, and I've assured that it's not trying to use a port that's already in use. I've also tried updating VS 2017.
Where do I start looking into this problem?
According to your description, I guess you may install some third-party extension in your visual stuido that casuing this issue.
I suggest you could try to ​​​​​​run VS with safe mode to check if this is working well or not.
About how to run VS in safe mode, you could refe to below way:
open CMD and go to C:\Program Files (x86)\Microsoft Visual Studio\2019\version name\Common7\IDE folder, run the command: devenv /safemode
Besides, I suggest you could try to reset all the VS setting to defauly.
Details, you could refer to this article.

Icon not showing up in taskbar after installing an application with Setup project Visual studio installer

I have to make a setup project for an application, I used Visual Studio Installer since the previous one was made with that.
The setup works fine, the application gets installed. The only problem that I have is that the icon of the application does not show up in the taskbar.
The icon appears in the folder, in the .exe, but when it launches, it does not appear in the taskbar.
If I copy the same folder in the same directory and open the application from there, it works fine. The icon appears.
I'm guessing the problem is in the folder that the setup generates, something about permissions maybe?
The only time that I get this problem is when I launch the application from the folder that the setup generated.
Any suggestions? I've been searching for a while for a solution and I haven't found anything.
Thank you very much.
It's quite hard to answer, from my experience there may be some missing "working directory" in a shortcut.

Visual Studio 2015 hanging after adding Azure SDK

So I set up the latest Azure SDK that integrates with Visual Studio 2015. It all seemed to work well and I was happily playing around with it for an hour or more in my small .net 4.6 MVC app with 3 projects in the solution. I went in to the Azure web portal and set up a new resource group there, and when I went back to VS I refreshed the Server Explorer my resource group was visible under App Service and data from the ApplicationInsightsExtension.log file appeared when I opened the file in a tab. All fine and dandy.
However, the next time I opened the solution VS hung and wouldn't respond. The active tab is the ApplicationInsightsExtension.log file and it seems to be trying to connect to Azure but is getting stuck. I've tried everything including rebooting etc but nothing works. I'm also opening VS in Admin mode
Is there a setting somewhere in the config / project files that specifies what tabs are opend when you open a solution? I'm thiinking if I stop the ApplicationInsightsExtension.log file from opening that might fix the issue. However I've looked in the .csproj and csproj.user files and can't see any setting that might correspond to this.
Visual Studio load error
You could reset your settings to prevent VS to restore your opened tabs.
Ensure your Visual Studio is Closed.
Navigate to your solution directory in windows explorer.
Ensure your are displaying hidden files on Solution Explorer. View Tab -> Show/hide ribbon group/ check Hidden items checkbox.
A folder named .vs must be shown now in Windows Explorer.
Navigate to .vs\<SolutionName>\v14
Delete .suo file in the directory.
Open your solution.
Now VS will not load any tabs by default, so maybe you can see what is happening.
Hope this helps!

Visual Studio 2015 not working after first successful debug

I have updated Visual Studio 2015 to the first update. Since then I cannot debug my code twice in a row. It goes like this:
I start VS and try to debug. So far OK
Change code, build and debug.
Try to reach a web but it never loads.
If I close the VS and load the solution again it works or If I do not change code in step 2.
Other thing I noticed is the IIS Express Worker process is consuming most of CPU time.
And apparently the symbols are not loaded (I do not see the messages of DLL loading in the status bar).
This is making my development process very slow and tedious.
The solution is a MVC project under 4.6.1 framework.
Any ideas? Thank you very much!!
You should boot Visual Studio into Safe Mode. To enter safe mode do the following:
Open Command Prompt, as Administrator.
Enter: cd C:\Program Files (x86)\Microsoft Visual Studio 14.0
Enter devenv.exe /safemode
If Visual Studio does load and debug, then more than likely an extension or an update is the culprit. This will allow you to also see which updates may have occurred. The other potential issue would be if your Internet Information System had an issue.
Otherwise if your Internet Information System is stuck 'on'.
CTRL + ALT + DELETE
Go to processes, end W3P process.
Try to launch and debug inside Visual Studio.
Otherwise, simply try restarting your computer. We would need more information, as this can occur for an assortment of reasons.
#Julen - I have the same issue as you and I have found a work-around.
Add the "Terminate all" button to your toolbar and use it instead of just stopping the debugging. This command kills the IIS Express process.
See how to add it here:
Automatically Kill IIS Express Process After Debugging (VS Express 2013 Web)
If your IIS doesn't shut down after stopping the debugger, you could do one of the tricks written in this blog post - but the opposite way because the article focuses on keeping the debugger on.
Here is the proposed solution 2 - to check "Enable Edit and Continue":
Similar to VS 2013, if you disable Edit and Continue IIS Express will continue to run when you stop your debug sessions.
Open the menu item Tools/Options, look for the Debugging/General option. Scroll down and uncheck “Enable Edit and Continue”
It might be hanging when trying to load external symbols. I had a problem with that before.
To test this theory:
Open the Tools menu.
Click 'Options'.
Find and expand 'Debugging' on the left.
In the 'Symbol file (.pdb) locations' list, uncheck everything.
Click OK and see if the problem reappears.

Stop debugging Visual Studio 2013 when browser closes

How can I automatically stop debugging Visual Studio 2013 when I close the browser window?
Only Internet Explorer can do this, as it's both a Microsoft product. Since Chrome has no direct access to Visual Studio it would be weird if Chrome could cut down the IIS process which is running on your PC.
If you like to see the "Stop debug behavior" you should use Internet Explorer as debug browser.
Aware this is an old thread, but adding because this came up for me first trying to work out why VS2015 wouldn't stop debugging when I closed Internet Explorer. Turns out, being 64-bit, is had picked the x86 version of IE to browse with and of course I never noticed the difference. When I went to "Browse with", there was "Internet Explorer (2)" there, which was the 64-bit version. That stopped debugging fine when I closed IE. When I went back in to Browse With, the original X86 one was gone.
Presume because this was an old project that had the x86 association saved.

Categories