How to use this?

Oct 14, 2008 at 5:01 PM
I have been trying to get xsd2code to work, but did not succeed yet. I am missing some information.

First of all, let me explain what I want to do. I would like to be able to have a set of classes that correspond to an XML schema that allow me to get an representation in dot net of any XML document that conforms to the schema. I hope XSD2Code can generate such classes for me.

Unfortunately, I cannot install VS.Net 2008 on my development machine. I made an attempt to port the add-in to 2005. This didn't work. The source code available as a dowload does not compile in VS.Net 2005 and to me, it looks like it won't do in VS.Net 2008, either.

I get compile errors like:
Error 2 'Xsd2Code.Library.GeneratorContext.CollectionObjectType.get' must declare a body because it is not marked abstract or extern C:\Documents and Settings\schreurr\My Documents\Visual Studio 2005\Projects\Xsd2Code\MyAddin1\Xsd2Code.Library\GeneratorContext.cs 70 13 Xsd2Code.Library

I see code:
        public static bool EnableDataBinding
Indeed, a body is missing.

Anyway, the source code could do with a Clean Solution and removal of source code binding information before being distributed...

This seemed a dead track.

The I saw: under release 2.1.: Improves productivity with visual studio add-in. So, there might be an older version that is a stand-alone (Console?) application. The documentation is contradictory. Does it include an add-in or is it just an add-in? Version 2.0 has does already mention the add-in. For now, just testing the 1.0 beta release... This builds and runs (unless the schema file is read-only). I still have to inspect the results, but it looks promising.

Can I benefit form the new version and use the latest release as a console application?
Could it easily be ported back to 2005?
Is the published source code in sync with the installer?

Oct 15, 2008 at 1:35 AM
Pascal will certainly give you a complete answer, I just can say you that there's no error in the code that is compiling perfectly under VS 2008.
What you're thinking to be the "missing body" problem is just a C# 3.0 feature...
As the code is using C# 3.0 syntax it can't be easily downgraded to VS 2005.
A trick to use the application : download VS 2008 Express edition (free), you can install it side by side with VS 2005 without any problem. Then open the projet under VS 2008, compile it and use the console project from the command line... At the same time you'll get an IDE running C# 3.0 and you'll be able to learn new features as "missing body" or LINQ ! :-)
Oct 15, 2008 at 10:27 AM
Olivier, thank you for your reply and RSchreurs thank for your post.
Just for information, I work on compatibility with VS2005.
I think supply in the next relase, a setup for VS2005.
Oct 16, 2008 at 11:40 AM
Thanks for the replies.

For now, I managed to create a useful class with the console application of version 1.0. For future use, I could just install VS.Net 2008 on my home Pc so I can generate classes easily and with the latest version of Xsd2Code.

In my opinion, support for VS.Net 2005 would not have to be a plug-in. A console application would do just fine.

Anyway, it is like a bit of magic to see how easily an object representation of my xml is generated. Good work!