How to export and import XSD file in Visual Studio?

How do I export and import XSD in visual studio? I just tried to make a copy and paste the xsd file into a new project, and VS2008 automatically created some wrapper classes for it. When I tried to add a query to the table in VS, I get an error that the connection strings are broken. I fixed this a bit by inserting the correct connection string in app.config, but I am still getting errors related to the connection string.

My question is not how to fix this connection string, but how to properly export and import the connection string? Is there a wizard I can use? Thanks

Update # 2 This XSD file that I use was created using VS studio by dragging and dropping tables using this tutorial http://www.asp.net/learn/data-access/tutorial-01-cs.aspx. I copied this XSD file and entered it into a new project, and an automatically generated VS code was created for it, which in this case “typed the data set”. In this new project, when I tried to add a query to a table in an XSD file (using the tutorial that I mentioned earlier), I got an error indicating that the connection string "xxxxxxxxx" does not exist (im rephrasing). This connection string "xxxxxxxxx" exists only in the project where I copied the XSD file, and not in the new project. Therefore, this xsd contains information dependent on web.config, in particular the connection string. Therefore, copying and pasting this XSD file does not work. I was hoping that there is a wizard export tool that separates the dependent information (for example, the connection string) and related parameters,so that I can correctly add it to another project and add the query to the table without errors. Hope this makes sense ...

+6
source share
2 answers

This does not work. The problem is that adding an existing dataset to a project only adds it as xsd. Visual Studio is thinking of an XML schema, not a dataset. This is true even in VS 2015. To make this work, after adding an existing xsd file, you must edit the project file using gvim or notepad and add the following lines:

Add to compilation section:

<Compile Include="MyDataSet.Designer.cs">
  <AutoGen>True</AutoGen>
  <DesignTime>True</DesignTime>
  <DependentUpon>MyDataSet.xsd</DependentUpon>
</Compile>

Look for ItemGroup tag with

<None Include="MyDataSet.xsd"/>

Change this line as follows and add a couple more Done tabs just like this:

<None Include="MyDataSet.xsd">
  <Generator>MSDataSetGenerator</Generator>
  <LastGenOutput>MyDataSet.Designer.cs</LastGenOutput>
  <SubType>Designer</SubType>
</None>
<None Include="MyDataSet.xss">
  <DependentUpon>MyDataSet.xsd</DependentUpon>
</None>
<None Include="MyDataSet.xsc">
  <DependentUpon>MyDataSet.xsd</DependentUpon>
</None>

Visual Studio. . xsd . , .

+2

XSD??

Visual Studio " " XSD. , . , ?

: XSD Visual Studio?

XSD Visual Studio, " ", . "/".

XSD / , " " "" " ".

Set build action

+1

All Articles