m0s*_*0sa 5 c# msbuild msbuild-task visual-studio-2010
如何在 ac# 项目中使用 c++ XSD 任务?我已经在 csproj 文件中创建了这样的任务:
<Target Name="BeforeBuild">
<XSD Namespace="$(RootNamespace).Xml" Language="CS" GenerateFromSchema="classes" Sources="Xml/schema.xsd" />
</Target>
Run Code Online (Sandbox Code Playgroud)
但是构建输出说,虽然智能感知在编辑项目文件时为我提供了 XSD 任务:
Error 1 The "XSD" task was not found. Check the following:
1.) The name of the task in the project file is the same as the name of the task class.
2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v4.0.30128" directory. MyProject.csproj
Run Code Online (Sandbox Code Playgroud)
哦,我使用的是 Visual Studio 2010 RC。
*
这是因为 C++ 目标未导入。因为 XSD 不是托管构建过程定义的默认任务之一。您需要添加一个UsingTask来引用它。将其添加到您的 csproj 文件中:
<UsingTask TaskName="XSD" AssemblyName="Microsoft.Build.CppTasks.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Run Code Online (Sandbox Code Playgroud)
祝你好运,杰米
| 归档时间: |
|
| 查看次数: |
4600 次 |
| 最近记录: |