Visual Studio doesn't run programs - visual-studio

I downloaded visual studio for C# and now my problem is that when I run a program the very first time it runs without issues but the second time after exiting the program it shows this (pressing f5 also does nothing):
I have tried repairing Visual Studio and uninstalling and reinstalling it but that also doesn't work. It happens to other files too like Python files or asp.net files. Anyone know what's going on?

Try setting your project as a StartUp Project.
See this answer for details.

Related

Visual Studio 2017 freezes on startup

When I start VisualStudio it frezzes on the start screen. But when I start it a second time while the first instance is open the second instance works fine.
It's not that important but what could cause that problem?
Not sure. Sometimes some Visual Studio extensions are locking up Visual Studio.
I think by default Visual Studio tries to update these extensions
that have been installed automatically.
Recently I was trying to run Visual Studio (at Home) and it would freeze if I tried to open a specific project. But I was busy, so I didn't pursue it further and did other things. Then a week or a few days later I tried to run Visual Studio (at home), and it locked up when I ran it. I tried really hard to fix it.
There is a way I don't like where you can delete all or most of the
extensions from the place Visual Studio installs them, but this is
messy, and it is easy to get rid of something you need, and may hard
to get it back where it works correctly again. So I now recommend against this since there is a better solution now, below!
I searched to find a solution, and someone on a Microsoft board I think said to run from a command prompt as Administrator: DEVENV /RESETSETTINGS, I tried that and it didn't work for me. Then I thought, run DEVENV /? to see what I can see, and I saw :
DEVENV /SAFEMODE
So I tried that and it worked! Note: it was still being run from the Visual Studio Developer Prompt as an Administrator.
Visual Studio loaded up correctly, and I was able to look at the
installed extensions.
Eventually I noticed that they all or a lot of them were disabled (probably because of this SAFEMODE parameter), and I noticed that it the most recently updated were at the top of the list. I noticed that a lot of them had been automatically updated by Visual Studio and started Uninstalling a bunch of the more recent ones, and reverted at least one of them, then later uninstalled it. Eventually, after about 6 to 10 uninstalls, I got it to where Visual Studio would load normally, without the /SAFEMODE parameter! Cool!
So I turned off the automatic updates, so this will never happen automatically again. If I load a new extension or update and existing one manually, I should always exit Visual Studio and reload it after not doing too many updates or installing too many extensions to see if these extensions allow Visual Studio to load.
Sometimes an extension will not freeze Visual Studio, but will have errors. The ones that are the big problem are the ones which prevent Visual Studio from loading all the way and freezing it up. But with the above solution, you can eventually, cleanly, uninstall all the latest updates or new installed extensions until you finally get Visual Studio to load normally!
This workaround should be more widely known, so I am putting my solution to it here. Hopefully what I found should help someone else who is in a hurry, without having a lot of time to burn trying to get Visual Studio running again without freezing!
I use Visual Studio Community 2017, and I got this same issue on startup until I stumbled on this solution that deals with some corruption in the .suo file. Before I open Visual Studio for the day, I first delete the .suo file in my project folder, and it starts up just fine.
It's in a folder called .vs next to the .sln file. You may have to go to folder options View and check "Hidden Items" in order to find this folder. Dig down in that folder and you'll find the .suo file. Delete it. When you startup the project in Visual Studio, it will automatically create a new .suo file. So you'll have to do this every time you reopen.

Visual Studio 2017 crash

We are running into a problem opening our MVC5 solution in Visual Studio 2017. It will show a message saying loading projects, followed by "Preparing solution" and then it just freezes. Some preliminary research has lead to suggestions like
Remove the hidden .vs folder
Repair installation by running as admin
Updating to the latest released VS build
Remove any node.js type folders that have deeply nested folder structure within the solution folder
However, none of these have worked. Has anyone else run into a similar problem using VS 2017 with their solution? There are no special commands on packages loaded on startup.
I was able to finally get it to work. I updated to the latest Visual Studio build 15.0.0+26228.10, but that did not seem to help. After removing my .vs folder before opening the solution multiple times, it finally started to load. I have no 3rd party extensions or tools running.
I installed visual studio enterprise 2017 version 15.0.0+26228.10. and productivity power tool extension. the studio keep crashing when load project. I uninstall everything and reinstall vs only, the crash problem disappeared.
Deleted the vs folder, but it didn't work.
Looked for recently changed files in the project, saw Web.csproj.user — when I removed this the project works again.
Visual studio 2017 keeps crashing when i try to launch it,all i did was to launch visual studio installer go to more which is under the product am using then clicked on repair and that got me running again.
We saw some lockups, especially during the start of Batch Builds, until we set this experimental feature to False:
Tools > Options : Text Editor > C/C++ > Experimental : Enable Faster Project Load.
I don't know whether it could apply to your problem or not, but it is related to loading projects, so...
Good luck.
I had the same issue and uninstalled the ankhsvn subversion plugin then closed and re opened vs 2017 ad it worked.

Visual Studio 2010 freezes on build with particular file open

So my Visual Studio 2010 is extremely slow (and sometimes freezes) when I have a particular file open and attempt to compile and run the project. I have to open the Task Manager and kill the process for Visual Studio to regain control. If I close this file, and open any other file in the Solution Explorer in my project, Visual Studio compiles and runs the program just fine. The build succeeds, but Visual Studio just freezes after that. If I attempt to do anything in the IDE, Windows will tell me that Visual Studio is not responding. I've tried commenting out everything but the bare essentials in the file that's causing the freezing, and that didn't work. In order to get my program up and running, I have to close the file and then build the project. Visual Studio will then build and run the program in a timely manner as long as the particular file is not open. This only started a few days ago, and I haven't made any changes to the code that could have done this, nor have I updated or installed anything else onto my computer. Any ideas would be greatly appreciated. Thanks.
I fixed this. What I did was run devenv.exe /log and looked through the log. It had the following warning in it: "The CTM file is out of date and should be deleted and rebuilt, but the file 'C:\ProgramData\Microsoft\VisualStudio\10.0\1033\devenv.CTM' could not be deleted." I went and deleted this file, and it did the trick. Now even with that particular file open, Visual Studio builds and runs the program just fine.

VS2013 Javascript Debugging

Does any one know how to enable in page JavaScript script tag debugging?
In vs2012 i can go to the page in visual studio which is running in the debugger and create a break point however in vs2013 i get "A breakpoint could not be inserted at this location"?
Thanks
try to keep your scripts in separate files and put the breakpoints in that files. I had the same problem but when I moved java scripts from my views to script files I was able to debug. It may not be a solution but at least you should be able to work.
There was a known issue in Visual Studio 2013 that caused breakpoints to not work correctly inside script blocks. A fix was made and is included in the recently released Visual Studio 2013 Update 2 RC, which you can install from http://www.microsoft.com/en-us/download/details.aspx?id=42307.

Visual Studio crash at start-up

My Visual Studio began crashing at start-up. In my search for finding a remedy, I found these two suggestions, but neither worked for me:
Launching Visual Studio while running in safe mode, and
Running repair on Visual Studio.
However, I found that if I logged into a different Windows account, Visual Studio was able to run from that account without crashing.
Here is an error code that that I observed in the crash report:
LCID: 1033
Can anyone provide a solution for returning my Visual Studio to working order?
For me it turned out to be the plugin that GitExtensions installed into Visual Studio 2013.
-- UPDATE: try this before uninstalling GitExtensions
#Enceradeira proposed in the comments to uncheck the Show current branch in Visual Studio option. In GitExtensions, you get there via Tools -> Settings -> Appearance:
-- END OF UPDATE
After uninstalling GitExtensions and reinstalling it with all VS plugin unselected my VS runs smoothly again.
I even put together a blog post about this issue because it bugged me so much.
Since you're able to run with another user login, something may be wrong with your local settings, you can try to reset them: devenv /resetsettings in Start menu -> Run.
Warning: this will restore visual studio to default settings.
In my case VS used to crash on a single solution. I resolved the problem by deleting the respective solutions's user file: SolutionName.suo
My colleague recently experienced a problem with Visual Studio 2013 crashing on start-up. Unfortunately, we found that the approach recommended in the answer by #Arun M did not solve the problem:
devenv.exe /ResetSettings
...however, using a different command line argument did:
devenv.exe /ResetUserData
An easy way to run devenv.exe is via the Visual Studio command prompt; on Windows 10, it can be found here:
Start Button => All Apps => Visual Studio 2013 => Visual Studio Tools =>
VS2013 x86 Native Tools Command Prompt
For more about these command line arguments for devenv.exe, see this answer to this related question: How do I truly reset every setting in Visual Studio 2012?. ⚠ In particular, please note the cautionary statement in that answer about the /ResetUserData command line argument!
Try to run VS as administrator. That's necessary in my case.
If coincident to these Visual Studio crashes you are getting "Heap corruption" (Exception code: 0xc0000005) errors in your Windows Application log (Faulting module name: WindowsCodecs.dll), here is something worth checking into: A faulty WIC component within Expression Blend can cause ALL versions of Visual Studio to crash upon launch, as well as cause Internet Explorer to crash upon visiting many, if not most sites. Even though Microsoft distributes this component, they call it a "non-Microsoft component". As such, a Visual Studio reinstall won't fix this,, an OS reinstall over existing Windows installation won't fix this, and a system file integrity check won't detect it.
If my case, the misbehaving codec was "C:\Program Files (x86)\Microsoft Expression\Common\Imaging\4.0.360.0\PSDCodec.dll", and simply unregistering this component got my Visual Studio working again from consistent startup launch crashes.
I post this in hopes this solution to one source of Visual Studio crashing might save others from the $500 Microsoft support incident fee and week of downtime this caused me.
I just changed the windows language in the bottom right to "EN", then started as admin. And it worked, interesting..
I had the very strange phenomenon that both Visual Studio 2010 and 2013 on a Windows 7 machine crashed when run in a remote desktop session, started from a Windows 10 pc. Debugging the crash showed a CultureNotFound exception. It was caused by regional settings on the Windows 10 pc, which could not be translated in something understood by Windows 7. I had language English(Belgium) with an Azerty keyboard. I added and selected English(UK) with an Azerty keyboard and the crashes disappeared. No other programs suffered from this.
For me it was being caused by Web Essentials and I was able to resolve by disabling it, restarting VS, enabling it back , restart again. Works now.
I had a crash on startup (or soon after startup, before opening any solution) occurring in git2-msvstfs.dll, caused by placing a 3GB temp file into a directory within my solution. Deleting the file fixed it.
Once I accidentally pressed a random key combination (maybe something like ctrl+', but I didn’t realize I was holding ctrl down so I forgot what keys I hit by the time I realized something bad had happened) that resulted in VS Professional 2017 15.3.5 crashing within half a minute. After relaunching, I found that VS would be interactive for a few seconds before it would crash within half a minute. It was really too fast for me to try to figure out what I had accidentally activated or for me to disable it before VS would crash. Also, it would even crash if I didn’t open any solution, so I figured it was not something that deleting a .vs (per project/solution Solution Explorer/open files state) folder would fix.
To fix, I followed Arun M’s comment and renamed my %LOCALAPPDATA%\Microsoft\VisualStudio\15.0_3f4d04be folder. You will need to adjust the path for the edition/version of VS that is crashing. On my machine, I think 15.0_3f4d04be is Professional and 15.0_0fed6c59 is VS Community Edition. You’ll probably have to guess based on the folder’s modification timestamp which is probably going to reflect the date you last used that edition of VS.
After renaming the versioned dotfolder, VS launched without crashing. It started with default settings but automatically restored some of my settings through the cloud sync stuff after a minute of running and it even remembered my account information so I didn’t need to sign in.
I did not need to rename my %LOCALAPPDATA%\Microsoft\VSCommon folder (which Arun M had also suggested).
I had a similar problem, both VS2015 and VS2013 would crash at startup. Tracked it down to an application I installed which put .net 4.7.2 on the system. Once i removed that app, removed .net, and reinstalled .net 4.6, Visual Studio started working again.

Resources