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?

4

3 回答 3

2

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.

于 2009-09-08T20:05:34.347 回答
1

There's a nice guide to integrate XSD compiler into Visual Studio (2003 - 2010). It might help you automate the process: http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio#Visual_Studio_2010_.2810.0.29

于 2011-02-28T21:59:04.523 回答
0

Another approach that worked for me when converting into a Web Application Project was to remove the .xsd file from the project and include it again.

VS 2008 automatically defined the "Custom Tool" property to use (MSDataSetGenerator) and re-creates the *.designer.cs file for me every time the xsd change.

于 2011-03-01T00:40:13.620 回答