2010-06-09 4 views
2

는 내가있어 (경로가 단축) : 결과VS2010 Web.config 변환을 NAnt에서 작동시키는 방법은 무엇입니까? 내 NANT 파일에서

<echo message="#### TARGET - compile ####"/> 
<echo message=""/> 
<echo message="Build Directory is ${build.dir}" /> 

<exec program="${framework}\msbuild.exe" 
     commandline="..\src\Solution.sln /m /t:Clean /p:Configuration=Release" /> 

<exec program="${framework}\msbuild.exe" 
     commandline="..\src\Solution.sln /m /t:Rebuild /p:Configuration=Release" /> 

<exec program="${framework}\msbuild.exe" 
     commandline="..\src\Solution.sln /m /t:TransformWebConfig /p:Configuration=Release" /> 

:

Build FAILED.  "C:\..\src\Solution.sln" (TransformWebConfig target) (1) ->   C:\..\src\Solution.sln.metaproj : error MSB4057: The target "TransformWebConfig" does not exist in the project. [C:\..\src\Solution.sln] 0 Warning(s) 1 Error(s)Time Elapsed 00:00:00.05 

솔루션 및 관련 프로젝트의 모든 VS2010하고 웹 응용 프로그램은 .csproj에서 올바른 참조를 가지고 있습니다.

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> 

이것은 올바르게 작동하지 않아야합니까?

답변

4

NAnt와 관련된 문제는 아니므로 솔루션 파일에 TransformWebConfig을 호출 할 수 없습니다.

솔루션 : 프로젝트 파일에

  • 전화를 :

    <exec program="${framework}\msbuild.exe" 
         commandline="..\src\WebApp\WebApp.csproj /m /t:TransformWebConfig /p:Configuration=Release" /> 
    
  • 재정의 프로젝트 파일의 AfterBuild 대상 TransformWebConfig를 호출 :

    <Target Name="AfterBuild"> 
        <CallTarget Targets="TransformWebConfig"/> 
    </Target> 
    
,
3

TransformWebConfig 옵션이나 AfterBuild 타겟에서 작동하지 못했습니다. 그러나이 post이 저에게 답이되었습니다. 즉, 이것은 내 "빌드"대상 NANT의 모습입니다 : 실행할 수있는 웹 사이트에 필요한

<target name="build" description="Compiles/Builds the Solution"> 
<echo message="Building..." /> 
<property name="build.configuration" value="Release" /> 

<msbuild project="${path::combine(staging.project,'_solutions\mySolutionName.sln')}" verbosity="minimal" failonerror="true" verbose="false"> 
    <arg value="/p:Configuration=${build.configuration};OutputPath=${path::combine(staging.output,'bin')}" /> 
    <arg value="/p:UseWPP_CopyWebApplication=True" /> 
    <arg value="/p:PipelineDependsOnBuild=False" /> 
    <arg value="/p:WebProjectOutputDir=${staging.output}\" /> 
    <arg value="/t:Rebuild" /> 
    <arg value="/nologo" /> 
</msbuild> 
<echo message="Building finished..." /> 

모든 파일은 웹을 포함하여, 지정된 "WebProjectOutputDir"속성에 복사됩니다. 변환이 적용된 구성. 이 설정 매력 :

-Diego

+1

처럼 일'UseWPP_CopyWebApplication = TRUE '트릭입니다 - 감사합니다! –

관련 문제