2012-02-14 8 views
1

빌드 스크립트에서 MSDeploy를 실행하면이 NullReferenceException이 발생합니다. 재미있는 점은 프로젝트가 전개된다는 것입니다. 이것은 나를 미치게했다. 참고 : 이것은 웹 응용 프로그램 프로젝트가 아닌 웹 사이트 프로젝트입니다.이 MSDeploy NullReferenceException은 무엇인가요?

내 빌드 타겟 파일이 사용하고 있습니다 내가 시도 할 수 있습니다 뭔가

"C:\TFS\MySiteBranch\Source\source.csproj" (Deploy target) (1) -> 
(Deploy target) -> 

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018: The "MSDeploy" task failed unexpectedly.\r [C:\TFS\MySiteBranch\Source\source.csproj] 

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object.\r [C:\TFS\MySiteBranch\Source\source.csproj] 

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018: at Microsoft.Web.Publishing.Tasks.Common.Utility.MsDeployEndOfExecuteMessage(Boolean bSuccess, String destType, String destRoot, TaskLoggingHelper Log)\r [C:\TFS\MySiteBranch\Source\source.csproj] 

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018: at Microsoft.Web.Publishing.Tasks.MSDeploy.Execute()\r [C:\TFS\MySiteBranch\Source\source.csproj] 

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r [C:\TFS\MySiteBranch\Source\source.csproj] 

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutio 

어떤 아이디어 :

여기
<ItemGroup>  
     <DeploySource Include="DirPath"> 
      <Path>C:\TFS\MySiteBranch\PrecompiledWeb\Source</Path> 
      <ComputerName>myComputer</ComputerName> 
      <UserName>anAdminAccount</UserName> 
      <Password>itsPassword</Password> 
     </DeploySource> 
    </ItemGroup> 

    <ItemGroup> 
     <TestDeployDest Include="DirPath"> 
      <Path>C:\TFS_Build\POC\Test</Path> 
      <ComputerName>myComputer</ComputerName> 
      <UserName>anAdminAccount</UserName> 
      <Password>itsPassword</Password> 
     </TestDeployDest> 
    </ItemGroup>  

    <Target name="Deploy"> 

     <PropertyGroup> 
      <WhatIf Condition="'$(WhatIf)'==''">false</WhatIf> 
      <MSDeployPath Condition="'$(MSDeployPath)'==''">C:\Program Files\IIS\Microsoft Web Deploy V2</MSDeployPath> 
     </PropertyGroup> 

     <MSDeploy Condition="'@(TestDeployDest)'!=''" 
      Whatif="$(WhatIf)" 
      Verb="sync" 
      Source="@(DeploySource)" 
      Destination="@(TestDeployDest)" 
      ExePath="$(MSDeployPath)" 
     /> 
</target> 

오류인가?

+0

프로젝트의 심층 계층 구조 때문일 수 있습니다. 사용중인 Visual Studio의 버전은 무엇입니까? – Bill

+0

VS 2010과 TFS 2010을 사용하고 있습니다.이 사이트는 기본적으로 웹 사이트이므로 내 프로젝트 파일을 정리해야합니다. 프로젝트 파일을 확인했으며 모든 대상 파일이 실행 중입니다. –

답변

0

나는 똑같은 것을 만났다. 문제가 무엇인지 파악할 수 없었지만 MSDeploy 대신 VSMSDeploy를 사용하여 해결할 수있었습니다. 두 작업 모두 동일한 DLL에 있으며 Microsoft.Web.Publishing.targets에서 사용하는 예제가 있습니다.

2

하면 다음과 같은 코드로 MSDeploy 요소에 ContinueOnError = "true"를를 사용해보십시오 :

<ItemGroup>  
     <DeploySource Include="DirPath"> 
      <Path>C:\TFS\MySiteBranch\PrecompiledWeb\Source</Path> 
      <ComputerName>myComputer</ComputerName> 
      <UserName>anAdminAccount</UserName> 
      <Password>itsPassword</Password> 
     </DeploySource> 
    </ItemGroup> 

    <ItemGroup> 
     <TestDeployDest Include="DirPath"> 
      <Path>C:\TFS_Build\POC\Test</Path> 
      <ComputerName>myComputer</ComputerName> 
      <UserName>anAdminAccount</UserName> 
      <Password>itsPassword</Password> 
     </TestDeployDest> 
    </ItemGroup>  

    <Target name="Deploy"> 

     <PropertyGroup> 
      <WhatIf Condition="'$(WhatIf)'==''">false</WhatIf> 
      <MSDeployPath Condition="'$(MSDeployPath)'==''">C:\Program Files\IIS\Microsoft Web Deploy V2</MSDeployPath> 
     </PropertyGroup> 

     <MSDeploy ContinueOnError="true" Condition="'@(TestDeployDest)'!=''" 
      Whatif="$(WhatIf)" 
      Verb="sync" 
      Source="@(DeploySource)" 
      Destination="@(TestDeployDest)" 
      ExePath="$(MSDeployPath)" 
     /> 
</target> 
1

저도 같은 문제를 가지고 있었다; 여기에 설명 된 수정을 사용하여 문제를 해결할 수있었습니다.http://forums.iis.net/p/1187159/2016131.aspx#2016131

나를 위해 x64 서버와 웹 응용 프로그램을 실행할 때 VSMSDeploy 작업을 사용할 수 없습니다. Visual Studio는 x86 버전의 msbuild 및 msdeploy 만 실행하므로 VSMSDeploy는 x86 서버 및 사이트에서만 작동합니다. appHostConfig 공급자를 사용하여 IIS 구성을 저장하고 appHostConfig가 x64 사이트를 msdeploy의 x86 인스턴스와 동기화 할 수 없습니다.