Got a bit of a weird problem. I'm checking a solution out of TFS source control, and not making any changes to it; just opening it using the SLN file. If I then close Visual Studio (or do a Save All), Visual Studio prompts me to save the SLN file. Even if I do (by overwriting it, it's a read-only file), it continues to do this every time I open and close the solution, as if I'd added a project or something. Why would Visual Studio do this? What's causing it to think the solution has changed and needs saving?
OK, problem solved. As we're using TFS for source control, you're meant to check in the SLN file's corresponding .vssscc file. As we'd checked in the .vspscc for the various projects the SLN file pointed to but not the SLN's .vssscc file, Visual studio didn't consider the solution to be bound. :-)
Fixed it by going to File | Source Control | Change Source Control, then binding the SLN file to the solution's root dir on the TFS server. This created the solution's .vssscc file, which we've checked into source control. Subsequent checkouts now don't cause the problem.
I would start by letting it save the solution and then doing a visual diff of the version that it saved vs the one held in source control to see what the problem is. It could just be white space formatting. Also, are you the only person suffering this (if others are using the same solution?)
Related
I'm running VS Enterprise 2015. This infernal thing keeps wanting to add my solution's .vssscc file to version control. My .tfignore has this line:
*.vssscc
The other items in .tfignore are working fine, but for some reason this one is not. There are no other .tfignore files in the directory tree. Surely I'm overlooking something, but I'm pulling what's left of my hair out trying to figure out what. Any suggestions?
*.vssscc stands for Visual Studio Solution Source Control File
When a solution is added to source control, a corresponding .vssscc file is created. The text file contains connection information and an exclusion file list, similar to the project hint file. This file is temporary and exists only in the source control database.
As a rule of thumb, we'd recommend letting Visual Studio handle those files. It'll add to source control the files it needs and leave out those not needed.
.vssscc files also manage the solution bindings, so better to have them controlled (by VS) .
Also, visual studio can have problems with the source control bindings if the files it needs are not under source control.
I'm working with Visual Studio 2010 Professional and use git with Git Extensions as a version control system. When I checkout a branch that involves different versions of the files which I'm working on, VS2010 prompt me with a message that says: "this file has been modified outside of the source editor. Do you want to reload it?" I click yes to all, and get the right version of the files. Until here everything goes as expected.
The problem comes when I checkout a branch that involves files to be deleted. Files that in that branch do not exist yet/anymore. If one of these is opened in the editor, it continues there and you can keep writing on it and then save it.
I know the files can't disappear from the project tree, because we're not keeping track of the project files (at least they get in Project File explorer an exclamation mark telling you that the file doesn't exist anymore). What I want is Visual Studio to close each file that no longer exist. Is there a way to do that? Or does someone have an idea to achive this workflow?
Closing and opening Visual Studio again does the trick, actually does exactly what I want.. But it would be good to avoid it.
Thank you
I think you have forgotten to include the project file vbproj or csproj in git
In Visual Studio, if I try to copy a file from one project to another (by using Copy and Paste or by dragging the file to the new project while holding the Ctrl key) it creates a reference to the source file in the original location. Is there a way to create a physical copy of the source file and place that in the target project source direction without having to resort to using Windows Explorer to copy the file manually?
It's not pretty, but when I want to do what you're suggesting, I double-click on the file in Visual Studio, which opens it. Then I do a File->Save As, choose the right directory and save it. All from within Visual Studio. This is usually followed by adding the new file to the other project.
Was just doing this and realized I should mention a side-effect. Depending on your source control (in my case, TFS 2010), doing this from within Visual Studio may modify the location of the file in the project. For me, this means making sure that neither the file nor its project have any pending changes, doing the save as, then doing an undo of the change this causes in TFS 2010 (project change, file add and delete).
From http://msdn.microsoft.com/en-us/library/0fb6xxhb.aspx:
If you are working with solution items, Visual C++ projects, or other similar projects, you are always working with links in Solution Explorer. If you are working with Visual Basic projects, Visual C# projects, and other projects, you might be working with links or files.
Essentially, the answer to my question is 'No'. In most cases, I must use Windows Explorer.
Certain user specific configurations are stored in .csproj.user. How do I tell MS Visual Studio to store this information in the .csproj every time?
I had the same problem and the only solution I could come up with was to manually edit the .csproj.user file, cut the configuration I wanted and paste in the .csproj file. It worked fine, despite being a somewhat user-hostile solution.
You can't. Visual Studio stores the user-specific settings in the .csproj.user file, and the build settings in the .csproj file. This is to allow multiple users to work on a project, which is critical when working in a team with source control.
That being said, you can always delete the .user file, and it will be recreated, at any point in time.
When I try to open my .sln file, Visual Studio quits on me. I can open it by opening up TFS, getting a specific version, choosing the latest version, forcing an overrwrite, opening up the .sln file, and then ignoring an 'incompatible doc message".
However, I would like to know what's wrong and how it can be fixed, in case some day I can't do this.
How can this be fixed?
I would think this is more likely to be the .suo (which is a hidden file). These are know to corrupt (and this has been true since at least VC++ V6). Deleting it will clear all sorts of odd/erroneous behaviour in VS.
(The .suo holds local settings: which files are open and layout, breakpoints, bookmarks, ... only: nothing that really matters to the solution or projects.)
For Visual Studio 2015 and 2017: rather than being in the same location as the solution (.sln) file, it is now held in a, hidden, folder called .vs in the folder containing the solution file.
In Visual Studio 2022, the .suo is in \.vs\MySolution\v17\
Have you tried creating a new sln and importing all the projs? if it doesn't solve the corruption, it may point to a project with a problem.
Get copies of both versions of the file and use your favorite dif tool to see what's changed. sln files are xml (i.e. human readable), so it isn't too hard to figure out what happened.
Difficult to tell. A sln file is quite simple structured, if you open it with a text editor,
check is everything looks all right to you.
Seems to me that the sln file could be in a conflicted state.