Button "Start Without Debbuging" doesn't do anything - visual-studio

I am using Visual Studio 2019. I wrote whole my program in c++ but when I want to try it and start the program without debbuging it doesn't do anything. I had same issue for more times but when I restarted visual studio the problem was fixed. But now I tried restarting VS, searching for help on the internet but I didn't find anything.
I am just begginer in VS so I don't know how should I fix it. Thanks for help.

Below are the instructions to fix this for projects that start as an "empty project". This fixed the issue for me.
"Please right-click your project name and go to Properties page, please expand Configuration Properties -> Linker -> System, please select Console (/SUBSYSTEM:CONSOLE) in SubSystem dropdown. Because, by default, the Empty project does not specify it."
You can also refer this link, might help... https://stackoverflow.com/a/4834914/693636

VS does not automatically run whatever is in your code window. You must go to Solution Explorer and identify which code to run by right clicking and setting it as the startup file.

Related

the breakpoint will not currently be hit at Vs 2015

In my WCF project at Vs 2015 when I add break point for debugging I got this message:
the breakpoint will not currently be hit no symbols have been loaded for this document.
I do googleing and none of other's answer worked for me !!!
for example: Right click the Solution in solution explorer, click "clean solution", this deletes all the compiled and temporary files associated with a solution.
and this and this
any suggestion?
thank you
If your solution is having shared projects with other solutions which is also open then close the other solution. Then clean the solution and restart Visual Studio. Then do rebuild (rather than build, though it is cleaned).
Hope this will fix the issue.
I finally got what is my problem. I have a big mistake. I decide write that , where was my problem because maybe it is helpful for other developer.
I fresh installed windows and after that I installed VS 2015. because I did not install IIS , Vs used of IIS Express. this is was my problem. for solve that, I installed IIS and then in properties of my project and Web section and server part I select Local IIS and then Create virtual directory. now my problem gone.
Right Click the Project and click properties.
Under Build the Active Configuration should be set to Debug.
While running the code with F5 or Play button.
Make sure Debug is selected instead of Release in the drop down next to Play button.
I put myself in a stupid situation.
I remember setting this, and it was a bad idea...
In the Attach to Process dialog, I had the Attach to: set to the older Managed setting 3.5, 3.0, 2.0.
when I should have been using Managed (4.6, 4.5, 4.0). I'm actually using 4.7, but this works for me.
Be sure to match your target framework!

Can't publish application in Visual Studio 2013

I have a very weird problem. In Visual Studio 2013 I working on an application for sorting and renaming files. It is not done yet, but I wanted to show it to some other people on another PC. I have tried almost every menu in every possible context but I simply can't find the publishing wizard or any other tool for that. Normally I should just do a right click on the project and have the option "Publish..." there, right? I have also tried the build menu. All I get is "Build", "Rebuild", "Clean" and "Code analysis". No option for publishing. Maybe I am just stupid and forgot to configure something? It seems like the word "publish" has completely vanished from the whole program. I have seen screenshots and in my VS the option is simply missing. Does anyone have an idea how to fix this?
I also tried adding an installer project, but then it just tells me that there was some kind of an error. No further information. Just "an error occured".
Any help will be appreciated! :)
Your application after build is in YourProject\bin\Release\ or YourProject\bin\Debug\ path.

Visual Studio “Go to definition” disabled or gray out

Visual Studio's Go To Definition is disabled and F12 doesn't work. Other commands like Alt-F12 may continue working.
Close the solution.
Delete the intellisense database file for the solution: [solution].ncb or [solution].suo
Reopen the solution.
Optional: Rebuild the solution.
Note that this can also be as a result of disabling database for C++/C#.
In Tools - Options, type "IntelliSense" into the search box, and click on C/C++ - Advanced. In the Browsing/Navigation section, change Disable Database to False, if it is not so already.
After re-enabling, close and reopen to force rebuild.
NOTE: IntelliSense will produce large files on disk (*.sdf and ipch) that should be excluded from Git, for example.
I know the solution has been resolved. However, I encountered the exact same problem. I searched internet. None of the trick works including this one.
Eventually, I figured out. I right clicked on the file that had the problem. I included the file in the project. Isn't that obvious. Actually not, the file has been included for a week. I have been working on that file more than 7 hours a day for the whole week. Up till yesterday 6:20 pm.
Oh, I could not compile correctly this morning. There were tons of syntax error message yesterday. This morning, I was able to compile. Strange. right? Then my go to definition was gone.
Took me a while to find out cs and designer.cs were certainly excluded, but aspx file was.
I solved the problem. Did my figure slip? I don't know.
That is one thing people check. Either yourself, someone else, or system accidentally exclude the cs files without the knowledge. I know it is strange, but it solved the problem. There are weird scenarios in Visual studio. People can present 200 solutions. They work for 99% of time, but not our cases. I just bring one more scenario
I encountered this in Visual Studio 2010.
For me, this solution did the trick
Close all the files.
Reopen the files.
and you are good to go.
This also happens, if Visual Studio has files opened, which are not in the current Solution.
I don't know how I got to this state, where files of a different solution where open as I didn't open them manually, but a quick check of the file path showed that those weren't files of the opened solution.
Therefore, "Go to Definition" was disabled.
I found that I had to remove my TFS mapping:
VS 2010 > open Team Explorer > Drill into the team project > double click source control > right click on the team project in the left pane and do "Remove Mapping" > after everything was removed I manually went to the local folder and deleted any lingering files > back in source control explorer I re-mapped to the same local folder and re-pulled all the code. Now the "go to definition" works again.
Not sure why I had to do this...
Check dll in references which is yellow. Remove it and add again.
I've just had this happen with a CMake-based C++ project in Visual Studio 2019. Everything was fine yesterday, then when I opened it up today all the Go To Definition/Declaration etc options were greyed out everywhere in every file in the project, even for things defined within the same file (and the syntax highlighting didn't look right either). It did work if I opened one of the .cpp files separately on its own (without loading the Project/Solution).
I tried various things including the answers here and telling it to generate the CMake cache again, but what finally fixed it was actually deleting the CMake cache. The Delete Cache option didn't seem to work (all the files were still there on disk, and there was some sort of failure message in the Output window) so I just deleted the entire "out" directory from the project directory (well, moved it somewhere outside of the project, just in case). Loaded up Visual Studio again, it rebuilt the cache again automatically and IntelliSense immediately started working again! I just had to wait 5 minutes for it to compile everything again when I wanted to run the project.
Maybe it wasn't necessary to remove the entire "out" directory, but when I clicked "Open in Explorer" under the "CMake Cache" menu it opened the actual build directory (which was the only thing in the "out" directory anyway) so I assumed the entire thing was related to the cache and was getting too fed up with it to try to narrow it down further. It's probably only certain files within that directory really.
Tried all the above solutions in my VS2019, nothing worked for me. Than I've noticed an update sign on the bottom Right corner. After updating the VS all options were restored.
Simple just check your bottom left corner of Visual Studio if Restricted turn it as a trusted and your problem will solve.
In my case due to my project is mapped with TFS so I am unable to go to definition also my project files showing read only when opening from Solution. So I have move to my root folder mapped with TFS and then right-clicked on folder > Go to properties > Attributes section was Read-Only I have unchecked it and clicked Apply. Reopen visual studio. Everything is now working fine.
I faced the same Issue in my Visual Studio 2019 version.I followed the below Steps:
Go to references folder in the solution.
Click on Manage Nuget packages.
Click on Browse.
Search for 'Microsoft.Net.Compilers'.
Click on Update.
This Worked for me.
In my case, another Visual Stuidio was opened (not closed succsessfully). Close all examples of VS, then re open solution.
Just open the Solution using Windows Explorer, instead of opening it from inside VS...

'RUN PEX' does not appear on rightclick

I run VS2010 Pro on a Windows XP machine.
I have downloaded and installed PEX & Moles. That all went fine.
When I open a C#-project and position the cursor on a class method and rightclick, I see no 'run pex' or 'pex' choice, as should be the case according to (install) docu.
As far as I could see I have done all by the book, but no joy.
It seems I forget something somewhere but what? Who can help me out?
I have noticed the same functionality when I added a reference to Pex to my project. When I removed it and right clicked the method body, then I could see "Run Pex" and "Pex."
I believe, and someone correct me if I am wrong, that you only need to reference the Microsoft.Pex.Framework in your Test project, not the project you are testing.
I had the same problem. I closed visual studio and opened it again. Voila, it's there.
So, I think the issue is when the Pex was installed, my VS2010 project was open. It can't detect it after Pex was installed. If you close the project and open it again, the option shows up.

A project with output type of class library cannot be started directly - with a startup exe

Firstly I'm completely aware of this message and why it happens normally. It's not that I'm just trying to run a dll (like this question).
I have a project that compiles to a dll but has a startup program specified in the project properties. Most of the time I'm able to right-click on the project and select Debug > Start new instance, and it will run the program and let me debug my dll. However, occasionally I get this message (A project with output type of class library cannot be started directly) as if I haven't got a startup program. The first few times I thought it was just me accidentally clicking on the wrong project but I'm certain this isn't the case given that it's happened so many times and I've been careful to watch it.
When this message appears I'm able to try it again and it always works on the second or third attempt.
A colleague using the same Solution never has this problem :-/
Anyone else had this problem or know how to solve it?
I'm using Visual Studio 2005 Pro Version 8.0.50727.762 (SP.050727-7600)
Edit: Also happens with Visual Studio 2010
Another colleague suggested it's because after clicking Debug > Start new instance, while I'm waiting for it to start up, I click on a different project. I don't do it for any reason, just randomly selecting things as I wait for the project to start up. Maybe Visual Studio looks at the selected project sometime after I clicked the menu, gets confused, and shows the error message?
Anyone able to confirm this matches their experience?
Typically problems in VS are caused by:
Add-ins: Run VS without and see if the problems is solved
Corrupted files in your solution: Delete / rename all files created by Visual Studio which are not part of your project, i.e. all .suo, .ncb files and a like.
I had this problem with projects that were created as "Windows Control Library" that somehow forget their status. Unloading and reloading the project usually did the trick.
If it was created as a "Class Library" then to make it a "Windows Control Library" I manually add the following to the .csproj file. It was the only difference I could see between a class library and windows control library project.
BTW - starting a Windows Control Library starts the User Control Test Container - allows you to test any user control in the library. Very cool.
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
add that inside of an <itemgroup> element.
If you plan to use/create/add extra dll's or just have more than one project in your solution, you may get this kind of problem, especially if you forgot a simple rule:
1. In your "Solution Explorer" window. Right click and chose "Set StartUp Projects..."
2. Under "Start Up Project" select and change "Single startup project" to your working entity.
no just make a start up project
Going to resurrect this thread, I have just been experiencing similar issues, when right clicking a project and start new instance..
So instead of right clicking the project and selecting start new instance, I right clicked and clicked set as startup project.
Low and behold a class library project was set to bold, certainly not the one I was right clicking.
I tried selecting a different executable project and setting that as the startup project. Same class library was highlighted as the start up project.
Realised that the current open file was from that project, possibly all the open files were from that project...
closed all open files and tried again.... Problem solved, behaviour as expected for both set as start up project and start new instance options...
Definitely a bug, hope this helps others..
Microsoft Visual Studio 2010 Version 10.0.40219.1 SP1Rel
Microsoft .NET Framework Version 4.0.30319 SP1Rel
This sounds like a transient Visual Studio problem. Reinstallation or upgrade may solve your problem.
I've seen this as well, and it seems like a bug in VS. It happens after you right-click/build a class library (that requires rebuilding), and then right-click/debug > start new instance.
edit- It's still very intermittent, I can't seem reproduce it reliably
I've found that I've had the Startup Project on the Solution set to Current selection, then at some point, I've unloaded a project, and the solution has reverted to Single startup project on a project that happens to be a class library.

Resources