如何使用 NAnt 0.90 构建 Windows 工作流项目?

发布于 2024-09-02 03:20:22 字数 1234 浏览 1 评论 0原文

我正在尝试使用 NAnt 构建 Windows 工作流 (WF) 项目,但它似乎无法构建“.xoml”和“.rules”文件。

这是我正在使用的 csc 任务的代码:

<csc debug="${build.Debug}" warninglevel="${build.WarningLevel}" target="library" output="${path::combine(build.OutputDir,assembly.Name+'.dll')}" verbose="${build.Verbose}" doc="${path::combine(build.OutputDir,assembly.Name+'.xml')}">
  <sources basedir="${assembly.BaseDir}">
    <include name="**/*.cs" />
    <include name="**/*.xoml" />
    <include name="**/*.rules" />
  </sources>
  <resources basedir="${assembly.BaseDir}">
    <include name="**/*.xsd" />
    <include name="**/*.resx" />
  </resources>
  <references>
    ...
  </references>
</csc>

这是输出:

将 21 个文件编译到“c:\Output\MyWorkFlowProject.dll”。

[csc] c:\Projects\MyWorkFlowProject\AProcessFlow.xoml(1,1):错误 CS0116:命名空间不直接包含字段或方法等成员

[csc] c:\Projects\MyWorkFlowProject\BProcessFlow.xoml(1,1): 错误 CS0116: 命名空间不直接包含字段或方法等成员

[csc] c:\Projects\MyWorkFlowProject\CProcessFlow.rules(1,1): 错误 CS0116: 命名空间不直接包含字段或方法等成员

[csc] c:\Projects\MyWorkFlowProject\CProcessFlow.xoml(1,1): 错误 CS0116: 命名空间不直接包含字段或方法等成员

I'm trying to build a Windows Workflow (WF) project using NAnt, but it doesn;t seem to be able to build the ".xoml" and ".rules" files.

Here is the code of the csc task that I'm using:

<csc debug="${build.Debug}" warninglevel="${build.WarningLevel}" target="library" output="${path::combine(build.OutputDir,assembly.Name+'.dll')}" verbose="${build.Verbose}" doc="${path::combine(build.OutputDir,assembly.Name+'.xml')}">
  <sources basedir="${assembly.BaseDir}">
    <include name="**/*.cs" />
    <include name="**/*.xoml" />
    <include name="**/*.rules" />
  </sources>
  <resources basedir="${assembly.BaseDir}">
    <include name="**/*.xsd" />
    <include name="**/*.resx" />
  </resources>
  <references>
    ...
  </references>
</csc>

Here's the output:

Compiling 21 files to 'c:\Output\MyWorkFlowProject.dll'.

[csc] c:\Projects\MyWorkFlowProject\AProcessFlow.xoml(1,1): error CS0116: A namespace does not directly contain members such as fields or methods

[csc] c:\Projects\MyWorkFlowProject\BProcessFlow.xoml(1,1): error CS0116: A namespace does not directly contain members such as fields or methods

[csc] c:\Projects\MyWorkFlowProject\CProcessFlow.rules(1,1): error CS0116: A namespace does not directly contain members such as fields or methods

[csc] c:\Projects\MyWorkFlowProject\CProcessFlow.xoml(1,1): error CS0116: A namespace does not directly contain members such as fields or methods

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

Hello爱情风 2024-09-09 03:20:22

如果您查看 Visual Studio/MSBuild 如何编译 WF 项目,您会发现它需要更多。

因此,使用 NAnt 驱动 MSBuild 并为您编译 Visual Studio 项目文件是迄今为止最好也是唯一的选择。

If you check out how Visual Studio/MSBuild compiles a WF project, you will see it requires a lot more.

Therefore, use NAnt to drive MSBuild and compile the Visual Studio project files for you is by far the best and only option.

一页 2024-09-09 03:20:22

为什么不使用 MSBuild,而不是直接调用编译器呢?它处理编译、引用等,因为它是在解决方案文件的基础上工作的。因此,将使用解决方案和项目中的设置,您不需要像示例中那样写出参数。

NAnt 不像编译器那样对 MSBuild 具有任何直接功能;但是,NAntContrib 有一个 msbuild 任务。这就是我使用的,它使我的构建脚本中的编译过程非常简单。这就是我的编译任务的样子:

<target name="compile" description="build the application">
    <loadtasks assembly="${dir.tools}\nantcontrib\NAnt.Contrib.Tasks.dll" />

    <msbuild project="${dir.src}\${file.solution}" verbosity="Minimal" failonerror="true" verbose="false">
        <property name="Configuration" value="${project.config}" />
    </msbuild>
</target>

Instead of calling the compiler directly, why not use MSBuild? It handles the compilation, references, etc since it works off the solution file. So the settings in the solution and projects will be used, you don't need to write out the parameters as in your example.

NAnt doesn't have any direct functionality for MSBuild like it does for the compilers; however, NAntContrib has an msbuild task. This is what I use, it makes the compile process very simple in my build script. This is what my compile task looks like:

<target name="compile" description="build the application">
    <loadtasks assembly="${dir.tools}\nantcontrib\NAnt.Contrib.Tasks.dll" />

    <msbuild project="${dir.src}\${file.solution}" verbosity="Minimal" failonerror="true" verbose="false">
        <property name="Configuration" value="${project.config}" />
    </msbuild>
</target>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文