Sunday, October 31, 2010

Auto checkout with VS2010 and TFS2010 not working

On my project “Simple Proxy Switch” I decided to access codeplex version control system through VS2010 TFS integration.

As I mainly use Subversion I like that you can edit files without locking them. As I arrived on TFS I missed this a lot. Searching for other options I found the ability of TFS to check out files on edit.

image

Nevertheless it doesn’t work for me. Files still are not getting checked out on edit.

Fast search at the web discovers some helpful links mainly again in the Microsoft Developer Network.

The missing setting was the binding of the solution to TFS. This can be achieved on Selecting solution and than go through

File –> Source Control –> Change Source Control

select solution and hit <Bind>.

Et voilĂ . Now VS2010 checks out files on edit.

Thursday, October 21, 2010

You are logged into a Temporary Profile

Shortly my new syspreppted virtual machine say’s “You are logged into a temporary profile.” WFT?

After a short search with my search engine of choice I found a solution for this on the Windows 7 IT Pro Forums. Detailed information about user profiles can be found on About User Profiles.

So this has been caused because I used this machine with the same domain account before I had sysprepped it.

In short:
Search user profile at
C:\Users\%username%
and delete it.
Open the registry editor and search for the profile with the corresponding SID at registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\ProfileList
and delete it.

Restart and try to log on. Problem should be solved.

Detect current network setting with C#

In cause of my latest project Simple Proxy Switch I had to face the challenge of detecting the setting of the current network the computer is connected to.

Now here’s my snippet how do I retrieve the current network setting:

// zero conf ip address
IPAddress zeroConf = new IPAddress(0);
// get current assigned addresses
IPAddress[] hostAddresses = Dns.GetHostAddresses(Dns.GetHostName());

var networkData = NetworkInterface.GetAllNetworkInterfaces()
  // filter running network interfaces
  .Where(network => network.OperationalStatus == OperationalStatus.Up)
  // filter unknown interfaces
  .Where(network => network.NetworkInterfaceType != NetworkInterfaceType.Unknown)
  // filter loopback interfaces
  .Where(network => network.NetworkInterfaceType != NetworkInterfaceType.Loopback)
  // get the properties
  .Select(network => network.GetIPProperties())
  // filter initialized gateways
  .Where(ipProps => ipProps.GatewayAddresses.All(gateway => gateway.Address != zeroConf))
  // filter and get ip addresses
  .SelectMany(ipProps => ipProps.UnicastAddresses.Where(ucAddress => hostAddresses.Contains(ucAddress.Address)))
  .Where(ucAddress => hostAddresses.Contains(ucAddress.Address))
  // simply use the first
  .FirstOrDefault();

Be the force with you!