views:

120

answers:

1

I am converting an older C# Website Project into a Web Application Project so that we can better manage it in our source control system. I have run into a problem.

The Website Project used strongly-typed-datasets (i.e. .XSD files). There is C# code written that uses these strongly typed datasets as an object. That worked fine when it was a Website Project but does NOT compile now that it is a Web Application project. The compiler can not find the reference to the datas set because datasets are not compiled.

Is there an easy solution to this problem?

+1  A: 

You could use XSD.exe on the command line to generate the dataset classes into a class file and add the file to the new project.

xsd.exe StronglyTypedDataset.xsd /dataset

This will generate the file "StronglyTypedDataset.cs". Use the /namespace:My.Project.Namespace flag if you need to put the dataset classes into a specific namespace.

This is essentially what's going on behind the scenes in your website project.

womp
I guess that Visual Studio stopped shipping with XSD.exe. Had to download it but it worked.
Gus
Depends which version of Studio you have. XSD.exe is actually part of the Microsoft .Net SDK, which installs with paid versions of VS.
womp