configuring visual studio 2012 & team foundation - visual-studio

I just started working in Visual Studio 2012 in a project group. We are using team foundation server to share our code. I have a couple of problems here I was hoping someone could help me solve them.
I have succesfully connected to our TFS-server and checked out the project, but for some reason when I check my solution explorer it says "0 solutions". I dont know if this is a problem but I feel like it has something to do with my other problems.
I can't, for some reason, press the play button to start debug, also in the menu the debug option is greyed out, 5 obv doesent work either. And in the "project" tab I dont have the option to set my project as startup project wich would make it so that I can debug it.

Check your Source Control Explorer. There you can navigate the code in TFS. Make sure there are files checked in to this location. If not, you will first have to add your project to TFS.
If there are files in TFS, map the files to a location on your harddrive. Then open the solution file by double clicking it in your Solution Explorer.
The MSDN has a nice walktrough: Set Up Team Foundation Server for Version Control

It turns out the local path has to be in the visual studidio\projects folder... re-mapped it and works as intended. No need to answer this anymore, thanks for your suggestions though :)

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

Visual Studio 2010 creates folder in current working directory on launch

Every time I launch Visual Studio 2010, it creates a directory called "Visual Studio 2010" in the current working directory at the time I launched it. It just started doing this at the same time that it forgot all of my toolbar settings and so on.
I've clearly got an incorrect setting somewhere, but I can't find it.
Under Tools\Options\Projects and Solutions\General I have:
Projects location:
D:\ian
User project templates location:
M:\Visual Studio 2010\Templates\ProjectTemplates
User item templates location:
M:\Visual Studio 2010\Templates\ItemTemplates
How do I stop this spurious .\Visual Studio 2010 directory being created and tell it to use the proper one on M:\ instead?
Edit: Since I've started a bounty on this, please be reasonable and don't post a suggestion that doesn't answer the question. For example, don't say 'Have you tried reinstalling?' or 'Have you tried deleting all your settings?' Thank you for your understanding.
Damn, too annoying. You don't know which plugin/addon or something do this...
So we can't find it too* Ok. thanks god, stackoverflow is here... Here is the solution;
Press Win + R
Type "regedit"
Go to this folder by treeview; "[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0]"
Edit everything which are like this; "Documents\Visual Studio 2010\"
Last step; In registry editor, press Ctrl + F
Search the string "Documents\Visual Studio 2010\". And change them too if anything appears...
I suggest an advanced registry editor for this.
Good luck & best regards...
UPDATE:
And if you still have the problem; open VS2010, go to "tools" > click "extension manager" > try to disable all plugins(I mean all of them). And play with VS again, create a new project etc. If there will be created a new folder( named like "Visual Studio 2010" ) in the "documents" then we will sure this comes from the ide:visual studio 2010( not add-ons ). Also, if you are using a "subversion control software" or "sdk service" try to disable them too... ( with disabling services in OS management )
This is the final answer that worked for me.
It turns out that Visual Studio 2010 regularly and automatically exports your settings file. (You would probably expect it to save your settings on exit, but not export them unless you explicitly ask it to.) I think it does this every time you quit, but it seems to create the directory into which it will export as soon as it is launched. This is the problem I was seeing.
This is how I resolved it:
Tools > Options > Environment > Import and Export Settings
The field Automatically save my settings to this file: was just Visual Studio 2010\Current Settings.vssettings. This is a relative path, so the folder Visual Studio 2010 was being created in the current working directory. I changed it to an absolute path M:\Visual Studio 2010\Current Settings.vssettings and this solved the problem.
This is another different way, so I'm adding a new answer here.
I don't want to edit my previous answer too much( It's started to looks ugly )...
Just go that link, download/copy the script, carefully save and edit for your needs;
https://github.com/jerker-back/VSUtilities/blob/master/custom_vspaths.js
and run it under admin.user.rights( or disable windows uac )...
Is it possible that you have a macro in your EnvirommentEvents that is causing this? Go to menu Tools -> Macros -> Macros IDE. Look in each of the macros trees in the Project Explorer for EnvironmentEvents to see if any of those macros is the culprit.
None of the solutions here worked for me. I don't think we've seen the golden bullet yet.
I had been writing to the same settings folder for years and all of a sudden that was no good for visual studio anymore. The folder was a networked folder. One day, every time I fired up a solution it would start making me yet another Visual Studio 2010 folder in the same directory as the .sln file.
I tried (and re-tried) specifying where settings are saved. I also went through and did some registry changes. In the end, what seemed to fix it was to re-config the IDE to use a local path, and then re-config it again to use the network path. I did this for all the paths you can set in Tools...Options...Environment...Import and Export Settings as well as Tools...Options...Environment...Projects and Solutions...General. And now I'm back to the setup I've been using for the last few years. It has stopped creating new folders every time I open a solution. For now, anyway.
The brute-force solution:
Run regedit and rename the folder [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio] to something like "VisualStudio_BAK".
Run devenc.exe /resetsettings to reset all settings to default.
If you don't know what you are doing, don't try this...! ;-)

How to work offline with TFS

Our TFS server has some temporary connectivity issues right now, and as such VS has gone unresponsive, leaving 50+ developers unable to work!
Is it possible to switch TFS into an offline mode in the event of such an issue?
See this reference for information on how to bind/unbind your solution or project from source control. NOTE: this doesn't apply if you are using GIT and may not apply to versions later than VS2008.
Quoting from the reference:
To disconnect a solution or project
from source control
In Visual Studio, open Solution
Explorer and select the item(s) to
disconnect.
On the File menu, click Source
Control, then Change Source Control.
In the Change Source Control dialog
box, click Disconnect.
Click OK.
The 'Go Offline' extension adds a button to the Source Control menu.
https://visualstudiogallery.msdn.microsoft.com/6e54271c-2c4e-4911-a1b4-a65a588ae138
plundberg: The "disconnect" button is only available for the TFS provider starting in VS 2008. Even then, I'm not sure if it's officially supported. The recommended way to use the Go Offline feature is to [re]open the solution.
Martin Pritchard: if you get stuck mid-operation, you can force VS to timeout by pulling the network plug (literally) or running ipconfig /release.
Once you're marked offline, here's a step by step guide to working in that mode: http://teamfoundation.blogspot.com/2007/12/offline-and-back-again-in-vs2008.html
More detailed info on tweaking the behind-the-scenes behavior:
http://blogs.msdn.com/benryan/archive/2007/12/12/when-and-how-does-my-solution-go-offline.aspx
http://blogs.msdn.com/benryan/archive/2007/12/12/how-to-make-tfs-offline-strictly-solution-based.aspx
There are couple of little visual studio extensions for this purpose:
For VS2010 & TFS 2010, try this
For VS2012 & TFS 2010, use this
In case of TFS 2012, looks like there is no need for 'Go offline' extensions. I read something about a new feature called local workspace for the similar purpose.
Alternatively I had good success with Git-TF. All the goodness of git and when you are ready, you can push it to TFS.
Depending on which tool windows you have open, VS may or may not try to hit the team server automatically when it starts up.
For best results try this:
Close all instances of visual studio
Open an empty visual studio (no project/solution)
See which windows are opened by default, if source control explorer or team explorer or any other windows that use team are opened (and activated) by default, close them or switch them to a background tab.
Close visual studio
You should notice now that you can start visual studio without it trying to hit the TFS server.
I know its just an aside to your problem, but I hope you find this helpful!
If you have a solution open, and TFS is down, you might have trouble going into offline mode. If you close and reopen your solution, a nice little dialog will appear asking you if you want to Go Offline.
Alternatively if you don't want to close/reopen the solution, (as suggested by Bernie) you can install the TFS Go-Offline plugin, then click:
TEAM -> Go Offline
Simply, change the root folder name for your solution in your local machine, it will disconnect automatically.
I just wanted to include a link to a resolution to an issue I was having with VS2008 and TFS08.
I accidently opened my solution without being connected to my network and was not able to get it "back the way it was" and had to rebind every time I openned.
I found the solution here;
http://www.fkollmann.de/v2/post/Visual-Studio-2008-refuses-to-bind-to-TFS-or-to-open-solution-source-controlled.aspx
Basically, you need to open the "Connect to Team Foundation Server" and then "Servers..." once there, Delete/Remove your server and re-add it. This fixed my issue.
If the code has already been checked out by the user that if offline and they have the latest version on their local hd, then they just need to browse to the solution location and open the solution by double clicking sln file. The solution will open in disconnected mode.

Resources