Question

Using: VisualSVN Server, TortoiseSVN, AnkhSVN

I used TortoiseSVN to make an initial repository load for all my .NEt projects AND supporting sources / resources that i want to keep.

I am planning to use tortoiseSVN for all general source control actions and AnkhSVN for within Visual Studio solutions.

My problem is that my repository now has the developer/machine specific files/directories that i dont need.

I know Ankhsvn by using the SCC API from Microsoft does not include them if you add the solution to the repository from within Visual Studio.

So what i need now is to go and batch delete the necessary files/directories from the svn repository.

These include (but i may add more):

thumbs.db Thumbs.db *.bak *.class *.exe *.dll *.mine *.obj *.ncb *.lib *.log *.idb *.pdb *.ilk *.msi* .res *.pch *.suo *.exp *.*~ *.~* ~*.* cvs CVS .CVS .cvs release Release debug Debug ignore Ignore bin Bin obj Obj Generated Logs *.csproj.user *.user

How can i do it without of course going one by one?

Additional Info:

One idea is what Micha has proposed HERE but that must occur before moving to the repository.

Était-ce utile?

La solution

I always recommend to developers to use AnkhSVN and not to use TortoiseSVN when using VisualStudio projects. AnkhSVN will not allow you to check in private user files into your VIsualStudio project.

To get rid of these files, you will have to checkout the repositories in order to delete individual files. There's now way to get around that. Sorry...

First you need a list of the VisualStudio files that shouldn't be in your Subversion repository.

Then, you should get a Windows command line version of the Subversion client. You can get this from SlikSVN. A command line based Subverison client will allow you to programatically remove the unwanted files without going after them one at a time.

For example, if you use Cygwin which provides a GNU/Linux-like environment on your Windows system, you could do something like this:

$ svn checkout $repo-project $workdir
$ find $workdir \( -name "*.suo" -o -name "*.csproj.user" \) -exec svn delete {} \;
$ svn commit -m"Removing all VisualStudio private files from repo" $workdir

Or you can write a short Perl, Python, or even PowerShell program to do this for you.

If you don't know PowerShell, it might be a nice first project to do in PowerShell. All versions of Windows since XP come with PowerShelL. PowerShell is a very powerful scripting language -- vastly more powerful than Windows Batch, and even more powerful than Bash shell scripting. Heck, it's the equivalent of Python or Perl in scripting prowess. I simply don't understand why it's so rarely used in Windows-based development sites. However, if you do learn it, you'll find it a powerful tool for all sorts of Windowy stuff. PowerShell integrates with Windows registry, IIS, and all sorts of System Services.

Once you've deleted all of these user files, you can use this Subversion pre-commit to keep them out of your Subversion repository forever. The control file entry would be something like this:

[FILE You cannot add private user files into a VisualStudio project]
match = VSproject/.*/\.(suo|user|webinfo|dll|exe)$
access = no-add
users = @ALL

Autres conseils

Best way is to do a clean up in VS before import to SVN.

If the files are still in repository I would recommend to do two checkouts. In one of them open VS an make a clean up, then make a file/directory-based compare of the two checkouts (and deleted the diff).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top