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
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.
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>
精彩评论