Visual Studio 2010:XML XSD模式到IDE中的类 [英] Visual Studio 2010 : XML XSD Schema to Classes within the IDE

查看:225
本文介绍了Visual Studio 2010:XML XSD模式到IDE中的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我需要从XML XSD模式创建类文件时,我在VS中使用.NET xsd.exe工具和预构建事件,以确保我的类和模式在构建时相互同步。这当然工作正常,但是...

Whenever I have needed to create a class file from an XML XSD schema, I use the .NET xsd.exe tool and prebuild events, in VS, to ensure that my classes and schemas are in sync with each other at build time. This of course works fine, however...

我注意到,如果XSD和派生类在同一个项目VS了解的关系和可视化显示CS解决方案资源管理器中的XSD文件的子代。所以我想知道在Visual Studio 2010中是否有任何功能在IDE中为我执行类创建,而不是依赖于预构建脚本?

I have noticed that if the XSD and derived class are in the same project VS understands the relationship and visually displays the CS as a child of the XSD file in solution explorer. So I was wondering if there is any functionality in Visual Studio 2010 to perform class creation for me within the IDE rather than relying on the prebuild script?

例如,添加XSD给项目在某个地方设置一些选项,VS接管并为我创建我的类。

For example, I would add the XSD to the project set some options somewhere and VS takes over and creates my classes for me.

VS 2010支持这样吗?或者我应该停止思考并继续使用xsd.exe和预构建。

Does VS 2010 support anything like this? Or should I just stop wondering and continue to use xsd.exe and prebuild.

EDIT
我也注意到XSD文件的属性我可以选择设置一个自定义工具,阅读描述这似乎接近我的目标,但我不确定这个的正确用法属性。

EDIT I have also noticed that under the properties of the XSD file I have the option to set a Custom Tool, reading the description this seems close to what I am aiming for but I am unsure of the correct usage for this property.

EDIT
此外,如果有一个解决方案,我需要这是基于特性/功能,标准配VS2010。我不想使用第三方插件等

EDIT Also, if there is a solution I need this to be based on the features/functions that come as standard with VS2010. I would prefer to not use a 3rd party addon etc

推荐答案

Visual Studio 2010本身不包含任何此类功能的一般消费。

Visual Studio 2010 in itself does not contain any such functionality for general consumption.

Visual Studio在ADO.NET中的类型化数据集上下文中对这种XSD到代码的转换有一些有限的支持,但这些不是通用解决方案,它们只针对一个使用场景。

Visual Studio has some limited support for this XSD-to-code conversion in the context of typed datasets in ADO.NET - but those are not general-purpose solutions, they are targeted at exactly that one usage scenario.

请检查 XSD2Code 加载项

这篇关于Visual Studio 2010:XML XSD模式到IDE中的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆