开发者

NAnt and System.Data.Entity.dll

开发者 https://www.devze.com 2023-02-09 02:20 出处:网络
I am new to NAnt and trying to set up a build file to build a few .Net 4.0 projects and run some NUnit tests. One of the projects contains an EF4.0 Data Model and context and I am running into an issu

I am new to NAnt and trying to set up a build file to build a few .Net 4.0 projects and run some NUnit tests. One of the projects contains an EF4.0 Data Model and context and I am running into an issue that even though the System.Data.Entity.dll reference is being included in the NAnt config, none of the System.Data classes contained in it are being found by the build (System.Data.EntityClient, System.Data.Objects, etc). I am using NAnt 0.91 Alpha 2. Anyone else run into this or have any idea how to get around it? Build file below.

Thanks.

<?xml version="1.0" encoding="utf-8" ?>
<project name="ClinicalModel">
    <property name="src.dir" value="" />
    <property name="output.dir" value="bin/debug" />
    <property name="entitysrc" value="..\Entities" />
    <property name="debug" value="true" overwrite="false" />
    <property name="nant.settings.currentframework" value="net-4.0" />
    <property name="framework-get-assembly-directory" value="${framework::get-assembly-directory('net-4.0')}" />
    <property name="dotNetReferenceAssemblyPath" value="${framework-get-assembly-directory}\" />
    <target name="clean" description="clean up already built files">
        <delete file="${output.dir}/Entities.dll" failonerror="false" />
        <delete file="${output.dir}/Model.dll" failonerror="false" />
    </target>
    <target name="build_entities" description="build entities">
        <csc target="library" output="${output.dir}\Entities.dll" debug="${debug}">
            <sources basedir="${entitysrc}">
                <include name="**/*.cs" />
            </sources>
        </csc>
    </target>
    <target name="build" depends="build_entities" description="build model">
        <csc target="library" output="${output.dir}\Model.dll" debug="${debug}">
         开发者_如何学Python   <sources>
                <include name="**\*.cs" />
            </sources>
            <references basedir="${output.dir}">
                <include name="**\*.dll" />
            </references>
        </csc>
    </target>

</project> 


This may not be the solution you are looking for but I would recommend letting msbuild do the actual build work. Since you don't want to build the entire solution you would end up making 4 calls (one for each project you want to build) to msbuild. Here is a snippet from my root build script:

    <property name="common.msbuild2010" value="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe" />
    <property name="common.buildType" value="Debug" />

    ...

<setenv>
   <variable name="DevEnvDir" value="C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\"/>
</setenv>

    <exec program="${common.msbuild2010}" commandline="&quot;${local.someCsProjName}&quot; /t:Rebuild /p:Configuration=${common.buildType}" />
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号