Delete files non-project files from SVN in Visual Studio - visual-studio

I am using AnkhSVN in Visual Studio.
How can I delete all files from SVN as I delete them from Visual Studio (files ARE NOT included in projects).
Ideally I would like to do:
Press "Show All Files" In Visual Studio (shows the files not included in projects).
Delete selected files (the ones not included in projects) from VS Solution Explorer.
Commit (Deletes the files in SVN)
But this is not possible and I have to delete files directly from Repository OR delete missing files from TortoiseSVN.
Cheers,
Dmitriy.

Your scenario should work. What's wrong with deleting missing files using TortoiseSVN?
TortoisSVN commit http://img21.imageshack.us/img21/5603/tortoisesvncommit.png

The easiest way to do it is using explorer. You can add a column to explorer called SVN Status. You can then sort the file view using that and delete the ones that you don't want..
(source: tigris.org)

I do not think AnkhSVN checks for files that are not in your project. Why don't you directly delete them in explorer using TortoiseSVN?

I either use a RapidSVN for that task, or add to VS Project (Add - Existing file) then delete, as Daniel says.

Related

Rename project folder in Visual studio and Team foundation server

My Visual Studio 2013 solution has a project "Test". I can rename it in solution explorer, but I also want to rename the project folder in disk and also reflect the change in Source Control(TFS). How can I easily do this?
Thank you
#CodeCaster, Thank you. Based on your advice, I have done some quick experiment, and worked it out. First step is rename the folder name in TFS; the new folder will appear in local workspace and all contents of the folder moved to this new folder. The old folder stays there with rest content which not belong to source control. You can delete it manually.
Or
Using TFS Power Tools to rename from Explorer.
I followed those steps to preserve the version history of the files inside of TFS:
Rename/move project file (.csproj) in source control explorer in VS (alternatively, this also works from within VS Solution explorer, simply select "rename")
Rename/move project folder in source control explorer in VS
now the project should be unavailable in VS, solution also gets closed
remove project from VS
add project (new path) to VS
fix project references in other projects
adjust namespaces if desired
adjust assembly name and default namespace in project settings
Don't know of an easier way. Was searching for this myself, and this should be the way to go.
I think you can rename it from the TFS Database.
Try going into tbl_Project of the Tfs_DefaultCollection Database, which you can find on the SQL Server Instance used by tfs. You can know which one is that by going into the TFS Console, click on Application Tier, then find the details of the Server under the Data Tier Summary. Run an update query against the project you want to rename.. I haven't tested this but just assuming it should work (some educated guess)..
I am using TFS 2015 Express and rename project is grayed out.
You can still rename the project using the TFS Site for the project.
Here is a link that shows how to do it.
https://www.visualstudio.com/en-us/docs/setup-admin/rename-team-project
I was facing a similar issue while trying to rename a folder in Visual Studio 2015.This is what I tried.
Right click on the project file
Open with Notepad
This will generate your current solution file
Change the occurences of your prev file name. (Find and Replace with the desired name)
Save it and close
Change solution explorer name and rename the folder to your desired name.
This should work.

Retrieving file from source control?

Hi guys when I open my solution from source control(TFS 2013) in the morning some folders in a class library project does not load but they are in the windows explorer so I had to "Include in project" the folder after showing all files in the solution explorer but there are no contents even though i "Get Lastest(Recursive)" but I checked the web(Tfs) in the code -> explorer there are files shown in the tree view. Is there a problem with tfs? or visual studio? or both? what can I do to resolve this?
Looks like you have files checked-in TFS but your project file in TFS doesn't have those files included. Also, when you get latest from TFS looks like you override the local changes.
I have three(ish) suggestions:
You have the directory with the included files mapped to a different place on your local drive. You can check this my looking at your workspace mappings (File -> Source Control -> Advanced -> Workspaces). If you have more than one workspace then make sure you're using the right one.
You can force TFS to download files that it believes it has already downloaded. Instead of GetLatest, choose Get Specific version (this may be on the same menu or under Advanced - can't remember for 2010). Check Overwright writeable and all files and select Get.
Install TFS Power tools and try adding the files that way (i.e. through windows explorer)
This isn't really a suggestion, as I don't believe it will work, but if the above don't, try it. As above, select get Specific version, but instead of Latest version, select Changeset and choose changeset 1. THIS WILL DELETE ALL FILES IN YOUR WORKSPACE. The do a get latest as normal.
HTH

How to add folders and move files into them in VS using AnkhSVN?

I tried accomplishing this using tortoise, but failed and reverted to my prior commit (How can I un-quagmirize my rearranged project?)
How can I add subfolders to my project and have them be recognized by Visual Studio AND Subversion?
Simply adding folders in Solution Explorer and dragging-and-dropping the files in Windows Explorer did not work.
It seems I can either add the files to the subfolders in Windows Explorer, but not have that rearrangement of file location recognized in Visual Studio's Solution Explorer, OR I can drag-and-drop the files within Visual Studio's Solution Explorer to the new subfolders, but that relocation is not recognized in Windows Explorer.
I HAVE re-added the subfolders within Visual Studio (I figure that can't break anything, while they are empty, anyway). Would right-clicking a file and selecting Refactor | Move be an accepted way to get this to work (I reckon the Refactor context menu item comes from Resharper, but possibly it's a VS "thing").
If at least one file is into a directory and this file was added via AnkhSVN (Subversion > Add), the directory will be automatically added as well.
If the directory is empty, even if the directory is included in the solution, the Add command via AnkhSVN will not work. This is a weird behaviour you can workaround using another SVN Client like TortoiseSVN.

Visual Studio and TortoiseHg: folder not visible in VS

I created a C# project and added it to source control (mercurial). I can edit files in VS, commit it and push it using TortoiseHg. It goes to the server. When some one pulls they get the files.
In my visual studio I added a folder and a file inside that folder. I used TortoiseHg and it saw the new file in the new folder. I committed it and pushed it.
However, now someone pulled the latest code from the server - and they got the new file (it is visible through windows explorer), but when they open the solution in VS, they don't see the file.
Does someone have an idea what is wrong here? or things I should check? Thank you for the help.
P.S. I have visual studio 2010 express (so I can't use the VisualHg plugin).
Visual Studio caches changes to the solution and project until an explicit save or a build. In your comment:
In my visual studio I added a folder and a file inside that folder. I used TortoiseHg and it saw the new file in the new folder. I committed it and pushed it.
I see that an updated .sln or .vcproj file was not mentioned and checked in. Did you see an update to either of these files via TortoiseHg? If not, make sure to build or save your project after a change like this.
Did you make sure that the Visual Studio Project File or Solution file is being updated and committed?
VS solution contains projects and each project select managed files by metadata(***.vcproj file). It's not the way include all files from root directory.
So, your co-workers can see new added files by in following two ways.
1) share project file(***.vcproj)
2) manually add files in each person's VS instance.

Renaming folders in SVN and VS.Net

I'm using subversion and Visual Studio 2008 (and Tortoise)
I've got a number of folders in visual studio projects that I want to rename.
Whenever I've tried this in the past I've ended up with conflicts and had to create my new folder, copy all the existing content in to it, check it in and delete the old folder.
Has anyone come across a more straightforward way to do this, or have a set reliable process for renaming folders in Visual studio and Subversion?
thanks in advance,
Chris.
TortoiseSVN has a feature to help with moves and renames performed outside SVN, after the fact.
Rename the folder as you would normally. Then right-click the root folder and select TortoiseSVN -> Check for modifications. In that list you'll see "oldfoldername missing" and "newfoldername unversioned". Ctrl-click on both of them, then right-click and select "repair move".
This way, you can rename folders and files with the benefit of VS's refactoring tools, but without messing up SVN.
There are two solutions. The first one:
You right click on the folder in in Visual Studio, and pick "Exclude from project"
You rename the directory with Subversion / TortoiseSVN / whatever (of course, you have to rename the folder with the rename command of a subversion client, otherwise you will end up in trouble)
You add the folder to the in Visual Studio project again
Second approach: You download some SVN plugin for Visual Studio such as VisualSVN or AnkhSVN and use them to rename the folder safely in Visual Studio.
Tortoise SVN has a rename feature built right in. Right click the folder, click Tortoise SVN, click Rename. You'll of course have to check in your change.
Using VisualSVN, I can just change the folder name in Visual Studio.
Without it, I have to remove the folders from the project in VS, SVN Rename the folders via Tortoise, and then readd the newly renamed folders to the VS project.
Using TortoiseSVN right-click on folder you want to move and while holding button down drag to new location. TortoiseSVN will then show you a menu with options....that should do it :-)
Cheers
Mike

Resources