Build VS2008 projects with .Net 2.0/.Net 3.5 using NAnt

微笑、不失礼 提交于 2019-12-14 04:06:00

问题


I'm trying to write a build file to build a simple C# solution but it is failing with the error: Unknown task or datatype.

My solution is written in VS2008 but targeted at .Net 2.0 (I'm using Vista if that helps).

I've already seen the other question running-builds-using-net-3-5-msbuild-and-nantcontrib and have tried the suggested solution and have made the change to my NAnt.exe.config file.

I've tried changing the solution properties to target .net 3.5 (and changing the build file accordingly, but with no success).

Can anyone suggest anything I might be missing?

My build file is as follows:

<?xml version="1.0"?>
    <project name="HelloWorld" default="build" basedir=".">
    <description>Builds the HelloWorld project.</description>
    <target name="build" description="compiles the source code">
        <echo>Building Hello World</echo>
        <property name="nant.settings.currentframework" value="net-2.0" />
        <msbuild project="HelloWorld.sln">
            <property name="Configuration" value="debug" />
        </msbuild>
    </target>
</project>

回答1:


ms build is a task in the Nantcontrib library. You have to download that put it where your build tool can get to it and then before the msbuild task use the LoadTask:

<loadtasks assembly="c:\foo\NAnt.Contrib.Tasks.dll" />

Once you do this it should work fine.



来源:https://stackoverflow.com/questions/685571/build-vs2008-projects-with-net-2-0-net-3-5-using-nant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!