How to generate XML Schema from XML file?

22 11 2009

Ever wondered how to generate XML schema from XML file?
Indeed, a lot of 3ed party tools can do it for you. But as usual, any easy way?

You can use Visual Studio IDE itself to generate XSD from XML file. Follow the steps.

1) Open the XML file in Visual Studio IDE.
2) Take View > Other Windows > Command Window.
3) Now type and execute command – XML.CreateSchema
4) See, the schema is generated.

A hidden pearl in VS IDE. Isn’t it?

Targeted Audience – Beginners.

How to enable warning for Deprecated Functions?

22 12 2008

If you port some of your old vc6 projects to Visual Studio 2005, you might have noticed that several function have become deprecated. Well, if you are a framework writer, its handy to notify user about the function which existed but deprecated. Well, how to do it?

You can use #pragma deprecated or __declspec(deprecated) to mark the deprecated functions. Then, if the function is used, compiler will shoot a warning while compiling. Check the code snippet below for how to do it in different conditions.

1) Deprecated Functions

// If you want to set Fun1() and Fun2() as deprecated.
#pragma deprecated(Fn1, Fn2)
Fn1();   // C4995
Fn2();   // C4995


// If you use __declspec(deprecated), then you can
// provide an error message as well.
void __declspec(deprecated("Fn1 is not supported")) Fn1()

2) Depricated Class

// If you want to set a class as deprecated.
#pragma deprecated( CFooBar )
CFooBar obj;   // C4995


// If you want to mark deprecated by using __declspec(deprecated)
class __declspec( deprecated("No Longer supported")) CFooBar

3) Overloaded Member functions

class CFooBar
    void Fun1()

    // Deprecating one of overloaded function.
    void __declspec(deprecated) Fun1( int a )
CFooBar obj;
obj.Fun1();        // Okay.
obj.Fun1( 0 );    // Error.

4) Error on deprecated function usage
If you enable – “Warning as errors” in Project settings, then the usage deprecated functions will halt the compilation which will be even more noticeable. Check the screenshot.

Well, take care that this functionality is only available for visual studio 2005 and younger siblings.

Targeted Audience – Beginners.

Microsoft Visual Studio 2008 Service Pack 1 Released!

21 08 2008

Visual Studio 2008 Service Pack 1 is released!
Download it from here.

Main features included in this service pack are –

Visual Studio 2008 SP1 features:

  • Improved WPF designers
  • SQL Server 2008 support
  • ADO.NET Entity Designer
  • Visual Basic and Visual C++ components and tools (including an MFC-based Office 2007 style ‘Ribbon’)
  • Visual Studio Team System Team Foundation Server (TFS) addresses customer feedback on version control usability and performance, email integration with work item tracking and full support for hosting on SQL Server 2008
  • Richer JavaScript support, enhanced AJAX and data tools, and Web site deployment improvements

The .NET Framework 3.5 SP1 delivers:

  • Performance increases between 20-45% for WPF-based applications – without having to change any code
  • WCF improvements that give developers more control over the way they access data and services
  • Streamlined installation experience for client applications
  • Improvements in the area of data platform, such as the ADO.NET Entity Framework, ADO.NET Data Services and support for SQL Server 2008’s new features

Enjoy the new Service Pack!!!