Removing web.config from disruption (ASP.NET project)

I have a project that is controlled by the source using Subversion and VisualSVN. Since the version of web.config is different on the server and on the development computers, I want the file to remain on the computers, but Subversion is ignored. I added it to svn: ignore, but it still remains (and still has a red exclamation mark, since we don’t do it).

How can I remove it from Subversion safely without deleting it from the file system

Thanks Adin

+4
source share
4 answers

you will need to perform the delete and ignore operation

  • first back up the local file (e.g. @ibz)
  • then delete the web.config file from the repository.
  • then copy the web.config file to the same folder
  • Finally, use svn: ignore so that subversion does not try to add it again to the repository

since I use tortoisesvn, I can’t tell you which svn commands you should use, but using tortoisesvn it will be:

  • make a backup
  • right-click on web.config in the folder under source control, select TortoiseSVN | Delete
  • right-click on web.config in the source folder, select SVN Commit => then you will notice that the file is actually deleted from the file system.
  • move up and right-click on the folder under source control, select TortoiseSVN | The properties
  • in the properties window, click the new + property name "svn: ignore"; property value "web.config". accept changes
  • commit changes

in my .net projects, I include the following exception with svn: ignore: bin, obj, * .suo, * .user

+6
source

Ideally, you should also support server-side versions of web.config in SVN. Usually, we rename the production web.config file to the web.config.prod file (a copy for each environment), and the build tool selects the desired file and renames it back to web.config during packaging for deployment.

+3
source
svn rm --force web.config svn commit 

Before doing this, be careful to back up your local copy (from web.config) as it will be deleted.

+1
source

I solved this problem using nant with ccnet. After assembly, nant script replaces the web.test.config file with the local web.config file;

 <?xml version="1.0"?> <project name="Project1" default="build"> <target name="init" depends="clean" /> <target name="clean" /> <target name="checkout"/> <target name="compile"/> <target name="deploy"/> <target name="test"/> <target name="inspect"/> <target name="build" depends="init, checkout"> <call target="compile" /> <call target="inspect" /> <call target="test" /> <call target="deploy" /> </target> <copy file="..\TestDeployments\Project1\Project1.Solution\Project1.Web.UI\web.Test.config" tofile="..\TestDeployments\Project1\Project1.Solution\Project1.Web.UI\web.config" overwrite="true" /> <delete file="..\TestDeployments\Project1\Project1.Solution\Project1.Web.UI\web.Test.config" /> </project> 

NAnt Copy Task

0
source

Source: https://habr.com/ru/post/1276644/


All Articles