Team System caches RegistrationEntries client side.
For about two months I have been working on an adapter that reads data from a source database and uploads it to custom dimensions in the TfsWarehouse. Yesterday I ran into a strange (at least, at that moment) problem. First I’ll explain the situation.
In the adapter I have a piece of code that queries the RegistrationEntries from the TfsIntegration database using the IRegistration service. The RegistrationEntry contains the database name of my source database and the database server name. I added the RegistrationEntry using the tfsreg.exe tool, providing an xml file with the data to store. An example of such an xml file is provided below.
xml version=“1.0“ encoding=“utf-8“ ?>
<RegistrationEntries>
<RegistrationEntry>
<Type>MyEntryType<< FONT>Type>
<ChangeType>Add<< FONT>ChangeType>
<Databases>
<Database>
<Name>MyDB<< FONT>Name>
<DatabaseName>MyDbName<< FONT>DatabaseName>
<SQLServerName>MyDBServer<< FONT>SQLServerName>
<ConnectionString>Server=@SQLServerName@;Database=@DatabaseName@;Integrated Security=SSPI<< FONT>ConnectionString>
<< FONT>Database>
<< FONT>Databases>
<< FONT>RegistrationEntry>
< FONT>
If you want access this information from code you do can something like this:
TeamFoundationServer server = TeamFoundationServerFactory.GetServer(“http://mytfs:8080“);
RegistrationEntry[] entries = ((IRegistration)server.GetService(typeof(IRegistration))).GetRegistrationEntries(“MyEntryType”);
RegistrationEntry entry = entries[0];
Console.Write(RegistrationUtilities.GetConnectionString(entry, “MyDB”));
The RegistrationUtilities class replaces the @SQLSevername@ and @DatabaseName@ by the corresponding elements of the RegistrationEntry and creates the ConnectionString for you.
If you just need to access the database name or the server name you can do that like this:
string databaseName = entry.Databases[0].DatabaseName; //using index 0 assuming that there’s just one database
string serverName = entry.Databases[0].SQLServerName; //to keep the example simple
string name = entry.Databases[0].Name;
Well, this should help you getting it to work if you would want to. Let’s get on to my problem now.
I used the tfsreg.exe tool again to update the setting to point to another database. Unfortunately the setting didn’t change when I tried to access it from code. Thinking the setting is cached by tfs I thought that an iisreset would do the thing….Not! Then I started thinking and searching for a location and file where tfs could store this information client side. It turned out that different kinds of settings and information is stored (per user) in different files in this folder:
C:Documents and Settings<user name>
On my machine it contains two files: ServerMap.xml, VersionControl.config and folder with a name like
Most important in my case was the file RegProxyFileCache.xml in the
Hope this helps!