2012-04-04 2 views
0

NAnt가 Windows Forms 응용 프로그램, 유틸리티 라이브러리 (DLL) 및 데이터 클래스 라이브러리 (DLL)로 구성된 프로젝트를 컴파일하는 데 문제가 있습니다. 문제는 응용 프로그램을 컴파일하기 전에 두 번째 단계로 컴파일 된 데이터 클래스 라이브러리를 참조하는 기본 WinEXE 응용 프로그램을 가져올 수 없다는 것입니다.NAnt vbc 빌드 사용자 정의 DLL 참조로드 중 오류가 발생했습니다.

이것은 NAnt에 대한 첫 번째 진출입니다 (MSBuild를 사용하기 전에이 기술을 사용하기로 결정했습니다). NAnt는 새로운 CI 서버에서 지원되기 때문에 NAnt를 사용하고 있습니다.

빌드 구성 파일을 업로드하고 서버에서이 파일을 시험해보기 전에 VS2005, VS2008 및 VS2010이 설치된 로컬 PC에서이 파일을 시험해 볼 것이라고 생각했습니다. 서버에는 설치된 .NET Framework가 없으며 NAnt 바이너리 배포판 만 있습니다. 여기

는 빌드 파일입니다

<?xml version="1.0"?> 
<project name="APP3" default="build" basedir="..\"> 
<description>APP3 build</description> 
<property name="nant.settings.currentframework" value="net-3.5" /> 
<property name="projectversion" value="3.8.0" /> 
<property name="project.config" value="debug" /> 

<target name="init"> 
    <call target="${project.config}" /> 
</target> 

<target name="debug"> 
    <property name="project.config" value="debug" /> 
    <property name="build.debug" value="true" /> 
    <property name="basedir.suffix" value="-debug" /> 
</target> 

<target name="release"> 
    <property name="project.config" value="release" /> 
    <property name="build.debug" value="false" /> 
    <property name="basedir.suffix" value="-release" /> 
</target> 

<target name="clean"> 
    <delete file="${project::get-base-directory()}${project::get-name()}_${projectversion}${basedir.suffix}\APP3_DataClasses.dll" failonerror="false" /> 
    <delete file="${project::get-base-directory()}${project::get-name()}_${projectversion}${basedir.suffix}\classUtilities.dll" failonerror="false" /> 
    <delete file="${project::get-base-directory()}${project::get-name()}_${projectversion}${basedir.suffix}\APP3.exe" failonerror="false" /> 
</target> 

<target name="build-classutilities" depends="init, clean" description="compiles the APP3 utilities class"> 
    <property name="build.dir" value="${project::get-base-directory()}/${project::get-name()}_${projectversion}${basedir.suffix}"/> 
    <mkdir dir="${build.dir}" /> 
    <vbc target="library" output="${build.dir}/classUtilities.dll" debug="${build.debug}" rootnamespace="classUtilities"> 
     <imports> 
      <import namespace="Microsoft.VisualBasic" /> 
      <import namespace="System" /> 
      <import namespace="System.Collections" /> 
      <import namespace="System.Collections.Generic" /> 
      <import namespace="System.Data" /> 
      <import namespace="System.Diagnostics" /> 
      <import namespace="System.Linq" /> 
      <import namespace="System.Xml.Linq" /> 
     </imports> 
     <sources> 
      <include name="${project::get-base-directory()}/classUtilities/Utilities.vb" /> 
     </sources> 
     <resources> 
      <include name="**/*.resources" /> 
     </resources> 
     <references> 
      <include name="System.dll" /> 
      <include name="System.Data.dll" /> 
      <include name="System.Core.dll" /> 
      <include name="System.Xml.dll" /> 
      <include name="System.Xml.Linq.dll" /> 
     </references> 
    </vbc> 
</target> 

<target name="build-dataclasses" depends="build-classutilities" description="compiles the APP3 data classes"> 
    <property name="build.dir" value="${project::get-base-directory()}/${project::get-name()}_${projectversion}${basedir.suffix}"/> 
    <mkdir dir="${build.dir}" /> 
    <vbc target="library" output="${build.dir}/APP3_DataClasses.dll" debug="${build.debug}" rootnamespace="APP3_DataClasses"> 
     <imports> 
      <import namespace="Microsoft.VisualBasic" /> 
      <import namespace="System" /> 
      <import namespace="System.Collections" /> 
      <import namespace="System.Collections.Generic" /> 
      <import namespace="System.Configuration" /> 
      <import namespace="System.Data" /> 
      <import namespace="System.Diagnostics" /> 
      <import namespace="System.Xml" /> 
      <import namespace="System.Xml.Linq" /> 
      <import namespace="Iesi.Collections" /> 
      <!--<import namespace="NHibernate" />--> 
     </imports> 
     <sources> 
      <include name="${project::get-base-directory()}/APP3_DataClasses/**/*.vb" /> 
     </sources> 
     <resources> 
      <include name="**/*.resources" /> 
      <include name="**/*.hbm.xml" /> 
     </resources> 
     <references> 
      <include name="System.dll" /> 
      <include name="System.Core.dll" /> 
      <include name="System.Xml.dll" /> 
      <include name="System.Xml.Linq.dll" /> 
      <include name="C:\Dev\NHibernate-2.1.2\Required_Bins\Iesi.Collections.dll" /> 
     </references> 
    </vbc> 
</target> 

<target name="build" description="compiles the source code" depends="build-dataclasses"> 
    <property name="build.dir" value="${project::get-base-directory()}/${project::get-name()}_${projectversion}${basedir.suffix}"/> 
    <mkdir dir="${build.dir}" /> 
    <vbc target="winexe" output="${build.dir}/APP3.exe" debug="${build.debug}" rootnamespace="APP3" main="APP3.My.MyApplication"> 
     <imports> 
      <import namespace="APP3_DataClasses"/> 
      <import namespace="classUtilities"/> 
      <import namespace="Iesi.Collections"/> 
      <import namespace="log4net"/> 
      <import namespace="LumenWorks.Framework.IO.Csv" /> 
      <import namespace="Microsoft.Office.Interop.Word" /> 
      <import namespace="Microsoft.VisualBasic" /> 
      <import namespace="NHibernate" /> 
      <import namespace="System" /> 
      <import namespace="System.Collections" /> 
      <import namespace="System.Collections.Generic" /> 
      <import namespace="System.Configuration" /> 
      <import namespace="System.Data" /> 
      <import namespace="System.Data.SqlClient" /> 
      <import namespace="System.Diagnostics" /> 
      <import namespace="System.Drawing" /> 
      <import namespace="System.Windows.Forms" /> 
      <import namespace="System.IO" /> 
      <import namespace="System.Xml" /> 
     </imports> 
     <sources> 
      <include name="${project::get-base-directory()}/${project::get-name()}/**/*.vb" /> 
     </sources> 
     <resources> 
      <include name="**/*.resources" /> 
     </resources> 
     <references> 
      <include name="System.dll" /> 
      <include name="System.Data.dll" /> 
      <include name="System.Windows.Forms.dll" /> 
      <include name="System.configuration.dll" /> 
      <include name="System.Drawing.dll" /> 
      <include name="${build.dir}APP3_DataClasses.dll" /> 
      <include name="${build.dir}/classUtilities.dll" /> 
      <include name="System.Xml.dll" /> 
      <include name="C:\Dev\NHibernate-2.1.2\Required_Bins\Iesi.Collections.dll" /> 
      <include name="C:\Dev\NHibernate-2.1.2\Required_Bins\NHibernate.dll" /> 
      <include name="C:\Dev\NHibernate-2.1.2\Required_Bins\log4net.dll" /> 
      <include name="C:\Dev\LumenWorks.Framework\LumenWorks.Framework.3.8.1\LumenWorks.Framework.IO.dll" /> 
      <include name="C:\Program Files (x86)\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11\Microsoft.Office.Interop.Word.dll" /> 
     </references> 
    </vbc> 
</target> 

그리고 여기에 출력의 첫 번째 많은, 잠시 동안 계속된다,하지만 당신은 오류의 처음 몇에서 요점을 얻을 :

NAnt 0.91 (Build 0.91.4312.0; release; 22/10/2011) 
Copyright (C) 2001-2011 Gerry Shaw 
http://nant.sourceforge.net 

Buildfile: file:///c:/Projects/Company/Windows Forms Applications/APP3-trunk/APP3/default.build 
Target framework: Microsoft .NET Framework 4.0 
Target(s) specified: build 

[property] Target framework changed to "Microsoft .NET Framework 3.5". 

init: 


debug: 


clean: 

[delete] Deleting file c:\Projects\Company\Windows Forms Applications\APP3-trunk\APP3_3.8.0-debug\APP3_DataClasses.dll. 
[delete] Deleting file c:\Projects\Company\Windows Forms Applications\APP3-trunk\APP3_3.8.0-debug\classUtilities.dll. 

build-classutilities: 

[vbc] Compiling 1 files to 'c:\Projects\Company\Windows Forms Applications\APP3-trunk\APP3_3.8.0-debug\classUtilities.dll'. 

build-dataclasses: 

[vbc] Compiling 24 files to 'c:\Projects\Company\Windows Forms Applications\APP3-trunk\APP3_3.8.0-debug\APP3_DataClasses.dll'. 

build: 

[vbc] Compiling 45 files to 'c:\Projects\Company\Windows Forms Applications\APP3-trunk\APP3_3.8.0-debug\APP3.exe'. 
[vbc] vbc : error BC30420: 'Sub Main' was not found in 'APP3.My.MyApplication'. 
[vbc] vbc : warning BC40057: Namespace or type specified in the project-level Imports 'APP3_DataClasses' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. 
[vbc] c:\Projects\Company\Windows Forms Applications\APP3-trunk\APP3\frmMain.vb(19) : error BC30002: Type 'Company' is not defined. 
[vbc] 
[vbc] c:\Projects\Company\Windows Forms Applications\APP3-trunk\APP3\frmMain.vb(49) : error BC30002: Type 'APP3_DataClasses.DataDictionary' is not defined. 
[vbc] 
[vbc]    APP3CompanyTypes = tQuery.List(Of APP3_DataClasses.DataDictionary)() 
[vbc]            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
[vbc] c:\Projects\Company\Windows Forms Applications\APP3-trunk\APP3\frmMain.vb(72) : error BC30002: Type 'APP3_DataClasses.Company' is not defined. 
[vbc] 
[vbc]    APP3Customers = tQuery.List(Of APP3_DataClasses.Company)() 
[vbc]           ~~~~~~~~~~~~~~~~~~~~~~~~ 
[vbc] c:\Projects\Company\Windows Forms Applications\APP3-trunk\APP3\frmMain.vb(133) : error BC30002: Type 'APP3_DataClasses.DataDictionary' is not defined. 
[vbc] 
[vbc]     Dim tType As APP3_DataClasses.DataDictionary 
+0

해결되었다. 좋아, 다른 일을 시도하는 반나절 후, 앞으로 슬래시가 문제이거나 오히려 하나가 부족한 것 같습니다. 다음 줄이 잘못되었습니다 : 이 이 이 올바른 라인 <이름 = "$ {build.dir} APP3_DataClasses.dll"/ 포함> : 이 <이름 = "$을 포함을 {build.dir} /APP3_DataClasses.dll "/> 다시 구조에 대한 Stackoverflow. 내가 이것을 게시하지 않았 더라면 나는 더 빨리 문제를 발견하지 못했을 것이다 .-) 나는 다른 많은 오류가 있지만 적어도이 문제는 해결되었다. – Dominik

답변

0

솔브 드. 좋아, 다른 일을 시도하는 반나절 후, 앞으로 슬래시가 문제이거나 오히려 하나가 부족한 것 같습니다. 다음 줄이 잘못되었습니다 : 다시

<include name="${build.dir}/APP3_DataClasses.dll" /> 

유래 구출 :

<include name="${build.dir}APP3_DataClasses.dll" /> 

이 올바른 라인입니다. 만약 내가 이것을 게시하지 않았 더라면 나는 그 문제를 더 빨리 발견하지 못했을 것이다 :-) 나는 지금 다른 오류를 가지고있다. 그러나 적어도이 것은 해결된다.

+0

[Duck에게 문의하십시오] (http://hwrnmnbsol.livejournal.com/148664.html) 행동의 원칙 ;-) –

관련 문제