Problem while connecting Visual Studio 2008 (Team Explorer) to a Team Foundation Server 2010

Problem while connecting Visual Studio 2008 (Team Explorer) to a Team Foundation Server 2010

When you try to connect your Visual Studio 2008 environment to a Team Foundation Server 2010 it is so popular that you will not be able to make it. After clicking Tools->Connect to Team Foundation Server and trying to connect to your own TFS you will receive one of errors, for example this:

1

 

What should you do now? Just go the link below:

VS 2008 Service Pack 1

Download Service Pack 1 for VS 2008 and then install it.

Remember, it is really important to install Team Explorer before installing Service Pack 1!

Then, when everything is installed you need to do one more thing – install Forward Compatibility Update for TFS. Go here: Forward Compatibility Update for TFS 2008

 

Now you are able to launch connection to a Team Foundation Server 2010.

 

IIS: ‘Cannot start W3SVC service’ or ‘unable to start debugging on the web server’. How to fix it?

IIS: ‘Cannot start W3SVC service’ or ‘unable to start debugging on the web server’. How to fix it?

While working with Internet Information Services (IIS) you can meet several problems. One of the most popular issue is a communique that you can’t start W3SVC. You can find a lot of articles in which people says that you should re-install IIS. But there is another way to fix it:

Cannot start W3SVC service

You need to open Start -> Search programs and files -> and search for services.msc (just copy this, paste in a search window and click Return:

1

Then in ‘Services’ list you need to find ‘World Wide Web Publishing Service’. Right-click on it and go to Properties:

2

Find ‘Startup type’ and select it to Automatic:

3

Apply and click OK button. Now when you try to debug your e.g. asp.net app you will see this alert (‘Unable to start debugging on the web server(…)‘):

4

The only thing that you should do now is to go to the IIS Manager and start your server. Then try to debug your code. Voila!

XML Serialization, part 2

As I promised, I made an example of using serialization and deserialization in C#

First of all we have to create class of objects which will be serialized/deserialized, let’s say Person.cs:


namespace Sample
{
 using System.Xml.Serialization;

/// <summary>
 /// The person.
 /// </summary>
 public class Person
 {
 /// <summary>
 /// Gets or sets the its name.
 /// </summary>
 [XmlElement("Name")]
 public string itsName { get; set; }

/// <summary>
 /// Gets or sets the its surname.
 /// </summary>
 [XmlElement("Surname")]
 public string itsSurname { get; set; }

/// <summary>
 /// Gets or sets the its age.
 /// </summary>
 [XmlElement("Age")]
 public int itsAge { get; set; }
 }
}

Then we should write a sample program which would do this 2 operations:


namespace Sample
{
 using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Xml.Serialization;

/// <summary>
 /// The program.
 /// </summary>
 public class Program
 {
 /// <summary>
 /// The main.
 /// </summary>
 /// <param name="args">
 /// The args.
 /// </param>
 public static void Main(string[] args)
 {
 var objectsToSerialize = new List<Person>
 {
 new Person() { itsName = "Jack", itsSurname = "Jackson", itsAge = 20 },
 new Person() { itsName = "Bob", itsSurname = "Bobess", itsAge = 21 }
 };

SerializeObjectToXml(objectsToSerialize);

objectsToSerialize.Clear();

 objectsToSerialize = DeserializeObjectFromXml(@"c:\test\test.xml");
foreach (var person in objectsToSerialize)
 {
 Console.Write(person.itsName + " " + person.itsSurname + " " + person.itsAge + Environment.NewLine);
 }

Console.ReadKey();
 }

/// <summary>
 /// The serialize object to xml.
 /// </summary>
 /// <param name="listOfPeople">
 /// The list of people.
 /// </param>
 private static void SerializeObjectToXml(List<Person> listOfPeople)
 {
 var newSerializer = new XmlSerializer(typeof(List<Person>));
 using (TextWriter swriter = new StreamWriter(@"c:\test\test.xml"))
 {
 newSerializer.Serialize(swriter, listOfPeople);
 }
 }

/// <summary>
 /// The deserialize object from xml.
 /// </summary>
 /// <param name="pathToXml">
 /// The path to xml.
 /// </param>
 /// <returns>
 /// The <see cref="List"></see> .
 /// </returns>
 private static List<Person> DeserializeObjectFromXml(string pathToXml)
 {
 var newDeserializer = new XmlSerializer(typeof(List<Person>));
 List<Person> newListForPeople;
 using (TextReader sreader = new StreamReader(pathToXml))
 {
 newListForPeople = (List<Person>)newDeserializer.Deserialize(sreader);
 }

return newListForPeople;
 }
 }
}

As you can see, first we serialize list of objects, and then clear this list. After this 2 operations we are able to find xml file at specified path. It should look like this:


<?xml version="1.0" encoding="utf-8"?>
<ArrayOfPerson xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <Person>
 <Name>Jack</Name>
 <Surname>Jackson</Surname>
 <Age>20</Age>
 </Person>
 <Person>
 <Name>Bob</Name>
 <Surname>Bobess</Surname>
 <Age>21</Age>
 </Person>
</ArrayOfPerson>

The last operation is to deserialize objects saved in this xml file. To do it we should initialize XmlSerializer object and then, using TextReader, read all of the values and insert them into a list which was cleared before this. That’s all!