views:

367

answers:

2

I have a project I'm working on where I have a team that is located in two different locations. We are using a source control system that integrates with VS 2008. We have created a solution folder where we store different web.config files so the different locations can pick and choose which configuration they need to use to run the project.

What I would like to be able to do is have the Web Project we are working on have a web.config file in the project, but be ignored by the source control system. The source control system we're using is SourceGear, and it is operating under its default configuration, which is very reminiscent of VSS to me. I would like to avoid having to exclude the web.config file from the project, but I don't see any other way without the source control system constantly trying to add the file back into the repository.

How can I ignore the web.config file with respect to my source control system without having to exclude the file from my project all together?

+2  A: 

Look into the Cloaking feature of sourcegear. The only downside is that it is a user-specific setting so everyone on the team would have to comply.

Chris Lively
I just looked into the Cloaking feature, and correct me if I'm wrong, but that would only hide a folder that I don't want to see. That's not my intention. What I would like to do is have the web.config file show up in VS but not have it show up as an addition to the project I'm working on.
Joseph
If this is a Web Site Project, then VS is always going to automatically put it under source control; nothing you can really do about that. Check out ginzotech's answer.
Chris Lively
+2  A: 

Although my answer is not specific to source control, one thing you may want to consider is adding custom config sections to your web.config, and retrieving a different configuration depending on the location (server it is deployed on).

I do this currently to deal with deployment to staging, testing, production servers. My configuration classes will determine what the server name is, and retrieve the configuration settings for that particular server. That way, I don't have to worry about touching the web.config again, or excluding it and using different files.

Here is an article on how to do this. Yes it is not exactly what you asked, but may be better than relying on source control and using different config files.

http://aspnet.4guysfromrolla.com/articles/032807-1.aspx

Thanks ginzotech, that's another option I could use aside from out right excluding the file from my project. I would have thought that what I'm trying to do would be supported by VS. It doesn't seem like an outlandish request to me, but perhaps it is.
Joseph
It is not an outlandish request at all. I have struggled with it for some time myself. If someone has another idea that would be great. The custom configuration idea is one I adopted years ago in .net 1.1 as the best option in this case though. Good luck to you!