CopyAllFilesToSingleFolderForMsdeployDependsOn钩子在本地工作但不在TFS内置时

时间:2014-03-28 12:03:39

标签: visual-studio-2012 tfs msbuild msdeploy

参考this article by SamStephensthis by Sayed,在使用Visual Studio 2012构建LOCALLY 包装 期间,我设法包含了其他相关文件。

当我在TFS中构建代码时,问题就开始了。查看日志,看起来似乎没有挂上CopyAllFilesToSingleFolderForMsdeployDependsOn。

CopyAllFilesToSingleFolderForMsdeployDependsOn = 
     ;
     ;

CopyAllFilesToSingleFolderForPackageDependsOn = 
     ;
     ;

所以我有一个带有CreatePackage.targets文件的Deployment.csproj,在这个目标文件中,它将构建Web应用程序项目。以下是该文件的片段,我将我从前面所述的两篇文章中学到的内容结合起来。

  <!-- Create Web Deploy package for local build. -->
  <Target Name="WebPackage" Condition="'$(TfsBuild)' == ''">
    <!-- MSBuild the project. -->
    <MSBuild Projects="..\webapplication.csproj"
             Targets="Package" 
             Properties="
             Platform=$(Platform);
             VisualStudioVersion=$(VisualStudioVersion);
             Configuration=$(Configuration);
             WebPublishMethod=Package;
             ExcludeApp_Data=false;
             DeployOnBuild=true;
             DeployTarget=Package;
             PackageAsSingleFile=true;
             PackageLocation=$(PackageOutputDirectory);
             PublishProfile=$(MSBuildThisFileFullPath);
             ExcludeFoldersFromDeployment=Scripts;             
             ExcludeFilesFromDeployment=parameters.xml;">            
    </MSBuild>
  </Target>  

  <PropertyGroup>
    <CopyAllFilesToSingleFolderForMsdeployDependsOn>
      DefineAssemblies;
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForMsdeployDependsOn);
    </CopyAllFilesToSingleFolderForMsdeployDependsOn>

    <AssemblySource Condition="'$(TfsBuild)' == ''">$(SolutionDir)\ProjectA\bin\$(Configuration)\ProjectA.dll</AssemblySource>        

    <AssemblySource Condition="'$(TfsBuild)' == 'true'">$(OutputDirectory)ProjectA.dll</AssemblySource>

  <Target Name="DefineAssemblies">
    <ItemGroup>
      <FilesToInclude Include="$(AssemblySource)">
        <Dir>lib</Dir>
      </FilesToInclude >
    </ItemGroup>    
  </Target>

  <Target Name="CustomCollectFiles">    
    <ItemGroup>
      <FilesForPackagingFromProject Include="@(FilesToInclude )">
        <DestinationRelativePath>%(FilesToInclude.Dir)\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>

所以问题是:为什么这在VS2012本地运行良好,而不是在TFS构建中? 我已经被困在这两天了所以我真的很感激任何帮助。

0 个答案:

没有答案