vb.net 从 XSD 创建 dataset.designer.vb

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/284708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 13:54:42  来源:igfitidea点击:

Creating a dataset.designer.vb from XSD

vb.netvisual-studio-2008xsddatasetdesigner

提问by lambsland

I have an .xsd, .vb, .xsc, and .xssfile for a dataset in Visual Studio 2008 that I copied over from another Visual Studio project, however I need to make changes to the dataset. Thus I got into the XSD file, created new columns, deleted ones that aren't needed, etc., etc. However I realized when I attempted to use the new dataset I did not have the Visual Basic code behind the scenes. This code is typically found in dataset.designer.vb. When I copied the old one over of course it was no longer valid since columns changed.

我有一个.xsd.vb.xsc,并.xss为数据集文件在Visual Studio 2008中,我从另一个Visual Studio项目中复制过来,但是我需要更改数据集。因此,我进入了 XSD 文件,创建了新列,删除了不需要的列,等等。但是我意识到当我尝试使用新数据集时,我没有幕后的 Visual Basic 代码。此代码通常位于dataset.designer.vb. 当我复制旧的时,当然它不再有效,因为列更改了。

How I can force Visual Studio 2008 to use a .xsdfile and to have it create/update its designer code?

如何强制 Visual Studio 2008 使用.xsd文件并让它创建/更新其设计器代码?

回答by

You just have to exclude your .xsdfile and include it again. It will regenerate your designer.vbfile.

您只需要排除您的.xsd文件并再次包含它。它将重新生成您的designer.vb文件。

回答by lambsland

I don't know if this is still a common problem for others, but I did find an answer (I think). Click the .xsd file in Solution Explorer. Update the "Custom Tool" property to "MSDataSetGenerator". This will automatically regenerate the *.Designer.vb file.

我不知道这是否仍然是其他人的常见问题,但我确实找到了答案(我认为)。单击解决方案资源管理器中的 .xsd 文件。将“自定义工具”属性更新为“MSDataSetGenerator”。这将自动重新生成 *.Designer.vb 文件。

回答by codeConcussion

You can right click the .xsd file and select 'Run Custom Tool'to regenerate the dataset.designer.vb file.

您可以右键单击 .xsd 文件并选择“运行自定义工具”以重新生成 dataset.designer.vb 文件。

回答by codeConcussion

THANKS for the help, in the end I JUST was able to get a dataset.vbfile generated using the xsd.exetool. It works for now, however, I still think something isn't set right in Visual Studio 2008 or at least the "Generate Dataset" menu option from the context menu on an XSD file is gone.

感谢您的帮助,最后我只能dataset.vb使用该xsd.exe工具生成一个文件。它现在有效,但是,我仍然认为 Visual Studio 2008 中的某些设置不正确,或者至少 XSD 文件上的上下文菜单中的“生成数据集”菜单选项消失了。

I'll just need to remember that if I modify the XSD file from here on out that Visual Studio isn't updating the .vbfile automatically, I'll probably get stuck with reusing the xsd.exeprogram.

我只需要记住,如果我从现在开始修改 XSD 文件,Visual Studio 不会.vb自动更新该文件,我可能会遇到重用该xsd.exe程序的问题。

For others the command is (using Visual Studio 2008 Command Prompt Window Tool, in Admin mode if using Windows Vista).

对于其他人,命令是(使用 Visual Studio 2008 命令提示符窗口工具,如果使用 Windows Vista,则在管理员模式下)。

xsd.exe /d /l:VB "XSD FILE LOCATION PATH"

/dmeans create a dataset code. /lis the language.

/d表示创建数据集代码。/l是语言。

The .vbfile will be created in C:\Windows\System32.

.vb文件将在C:\Windows\System32.

回答by Joel Coehoorn

Unfortunately, this is in the gray area of things things that I can do when I need to, but I haven't needed to do enough to impart the knowledge to others.

不幸的是,这是我在需要时可以做的事情的灰色区域,但我不需要做足够的事情来将知识传授给他人。

All I know is that *.designer.vbmeans that this code was generated by Visual Studio, and if it generated it once it can do it again. Additionally, the very few times (maybe twice, both in Visual Studio 2005) that I have done this, it seemed like it was as simple as adding the *.xsd file to Solution Explorer. If that alone doesn't do it, try showing all files or right/double clicking on the *.xsd.

我所知道的是,这*.designer.vb意味着这段代码是由 Visual Studio 生成的,如果它生成一次,它可以再次生成。此外,我这样做的次数很少(可能两次,都在 Visual Studio 2005 中),看起来就像将 *.xsd 文件添加到解决方案资源管理器一样简单。如果单独这样做还不行,请尝试显示所有文件或右键/双击 *.xsd。

回答by Riaz

Just delete the extra designer.vb file created when u add the xsd file.

只需删除添加 xsd 文件时创建的额外 Designer.vb 文件。