-->

How to prevent VS 2008 from publishing .svn folder

2020-06-03 07:39发布

问题:

When publishing an asp.net web site in Visual Studio 2008, is there a way that I can force it to ignore the .svn folders in my local working copy so that my target folder does not end up with .svn files as part of the output.

Thanks,

Jason

回答1:

Visual Studio has a problem with ".svn" folders inside web sites. Therefore, you should apply the subversion ASP.NET hack, which uses "_svn" directories instead of ".svn".

When using TortoiseSVN, this is simply an option in the TSVN settings (see the General page). When using the SVN command line client, then you have to set an environment variable (see this page for details).

After applying this workaround/hack, the publish website operation will work as expected (the _svn folders are ignored).

UPDATE:

The problems mentioned above, existed with Visual Studio 2003 (resp. the front page extensions it used). Newer versions of Visual Studio should not have the problem.

So the key seems to be to simply set the hidden flag on the subversion folders (_svn or .svn). Then the folders are ignored when publishing the website. (I'm using TortoiseSVN, and I guess it automatically sets the hidden flag on the subversion folders).



回答2:

The bin folder shouldn't be part of your source control, simply right click the Bin folder in the solution explorer and 'exclude from project'.

now use windows explorer, find your bin folder and delete the .svn folder(s).

next time you publish (after deleting everything) you won't have the .svn files there, also, each time you build your solution, it won't look like you need to check in changes.



回答3:

You can right click on the folder in VS and remove it from the project, or you can make sure any of the files contained in the folder have their Build Action set to None and Copy to Output Directory set to Do not copy