Visual Studio 2012 – Paste XML as Classes

images (1)

Here we have a new version of Microsoft Visual Studio, Visual Studio 2012.

This new version is coming out at the time of diversification of computing technology and platform. So this new version is loaded with new capabilities for Windows 8, the web, SharePoint, mobile, and cloud development.

This new version has brought a lot of new and interesting features. Out of which today I was more exited with feature “Paste XML as Classes”.

Paste XML as Classes

Say you have a well formed XML file and need to deserialize it to a fully qualified .Net type objects. Building this manually is a very dull and monotonous job. Visual Studio 2012 has a new feature “Paste XML as Classes”.

Below is one sample well-formed XML.

Copy the XML content and open a new class file. From the menu select select Edit | Paste Special | Paste XML as Classes as shown below.

Visual Studio will automatically generate the code as shown below.


About Krishnaraj Barvathaya

I am Krishnaraj Barvathaya, a software developer from Bangalore and I primarily write on Microsoft Technologies and latest technical stuffs which interests me.

Posted on September 14, 2012, in .Net and tagged , , , . Bookmark the permalink. 4 Comments.

  1. Dear Krishnaraj, I also have installed the last Visual Studio Ultimate 2012 and I was looking for the Past Special feature but I cannot see that item in the EDIT menù!! After the voice “Cycled Clipboard Ring” I see the “Delete” one and “Past Special” is missing.
    DO I need to enable something or to be in a project of a particular type? Now I am in a project with target Windows Phone and, as I already told you, I do not see that voice in the EDIT menu …
    Any idea why and what I can do to have and use that feature?

    In the past I used a similar feature as an Add-in coming from the WCF REST Starter Kit but even following again the instructions I followed for the past VS version ( I cannot succede to make appear the menu voice “Paste Xml As Type” (that was the name).
    Thank in advance 😉

  2. I succeded to use that feature at the end! 😉

    That that feature do not work if the project is a Windows Phone vers. 7.1 !!! It works if the target is Windows Phone 8.0

    I think is a bug of VS2012 ….

  3. In general option only appears when you have .Net project version 4.5 onwards.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: