我正在使用以下命令,但它不起作用:
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin>xsd /c /l:cs SubsystemReg.cs
假设这是我的类(class):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace PaymentControllerGUI
{
public class EmptyClass
{
}
}
我正在尝试这个。
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin>xsd/c/l:cs EmptyClass.cs
错误:
invalid command line argument: 'SubsystemReg.cs'
最佳答案
使用 XSD.exe
,您应该传递编译您的类的 DLL
文件路径,改为 你现在传递的 CS 类代码文件本身。
例如,如果您的类在 SubsystemReg.dll
中编译,则像这样调用 XSD.exe:
XSD.exe C:\SubsystemReg.dll
这是来自 MSDN 的示例:
The following command generates XML schemas for all types in the assembly myAssembly.dll and saves them as schema0.xsd in the current directory.
xsd myAssembly.dll
更新:
您可以通过指定类型的完全限定路径从特定类型的 DLL 生成 XSD,例如:
xsd.exe YourAssembly.dll /type:YourNamespace.YourType
根据您的情况,只需执行以下操作:
xsd.exe PaymentControllerGUI.dll /type:PaymentControllerGUI.EmptyClass
关于c# - 如何使用 visual studio 命令提示符从 C# 类文件生成 xsd?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22192313/