Lock a specific file during the "registration" process?

I use Visual Studio and TFS to work on a project with many participants. We have a file containing some system settings and a connection string. Settings apply to each computer on which the project is running.

Whenever we do "Check In", this file appears in the modified files. Do you have a way not to include these files in the registration process?

+4
source share
2 answers

What I usually do in these situations uses a T4 file. With T4, you specify the code in the file how the file should be generated. Thus, most of the file is just text, and only the connection string section contains switch syntax that generates another connection string based on the current context (for example, username or computer name).

For a good example, see http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-config-files/ .

+1
source

I would recommend a completely different approach:

For connection strings, I would recommend that your connection string be exactly the same, something like DeveloperServer/DeveloperInstance . Then on each machine, you can aliases this name to any server that they need to use. This is beneficial for two reasons; first, this means that your .config files do not need to be changed and will be homogeneous with respect to all development environments, and secondly, if one developer needs to switch to another server / instance for testing, he can do this in his own environment, without affecting other developers.

How system settings for you I'm not sure what it is that I cannot help.

0
source

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


All Articles