Groups | Blog | Home
all groups > visual studio .net general > february 2005 >

visual studio .net general : Adding an existing Typed Dataset (xsd) to a project



Jeronimo Bertran
2/23/2005 7:14:12 PM
When a new typed dataset is created in VS.net, both the xsd file and a cs
file with the underlying class is created. However, the cs file is hidden
from the Solution Explorer.

Now if I want to add an existing typed dataset (from an existing xsd an cs
file), If I only add the xsd file, the cs file is not added and therefore
the cs class is not available... If I add both files, then I am able to use
the class but I see two disting files in the Solution Explorer. What is
the difference when a Dataset is created and when it is added?

Thanks

Sylvain Lafontaine
2/24/2005 12:49:24 AM
In the properties for the XSD file, set the Custom Tool property to
MSDataSetGenerator and make sure that the Build Action is « Content ». You
may also want to copy the XSX file for the graphical appearence of the
schema.

S. L.

[quoted text, click to view]

Martin Smith
2/24/2005 6:21:05 AM
To manually associate files in Solution explorer you need to edit the
*.csproj file. An example of how it should look is below...

<File
RelPath =
"StronglyTypedDatasets\dsSelectContentPositioningDropdown.xsd"
BuildAction = "Content"
Generator = "MSDataSetGenerator"
LastGenOutput = "dsSelectContentPositioningDropdown.cs"
/>
<File
RelPath =
"StronglyTypedDatasets\dsSelectContentPositioningDropdown.cs"
DependentUpon = "dsSelectContentPositioningDropdown.xsd"
SubType = "code"
BuildAction = "Compile"
DesignTime = "True"
AutoGen = "True"
/>





[quoted text, click to view]
v-kevy NO[at]SPAM online.microsoft.com
2/24/2005 6:45:12 AM
Thanks for Sylvain's quick response.

Hi Jeronimo,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know the relationship
between the .xsd file and .cs file. If there is any misunderstanding,
please feel free to let me know.

When you add a .xsd file, modify it and save it in VS.NET IDE, a .cs file
will be generated according to the schema. The .cs file includes the data
type definition that is used by the strong typed DataSet. Actually, when
you're trying to copy a DataSet schema to another project, you just need to
copy the .xsd file only. After adding it to the project, the .cs file will
be generated automatically during saving or building.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Jeronimo Bertran
2/24/2005 5:13:23 PM
Thanks .. this was the problem

"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in news:ebrlaSjGFHA.2592@TK2MSFTNGP10.phx.gbl:

[quoted text, click to view]
AddThis Social Bookmark Button