VS 2012的发布配置文件和复制文件使用MSBuilld命令 [英] VS 2012 Publishing Profiles and Copy Files Using MSBuilld Commands

查看:1834
本文介绍了VS 2012的发布配置文件和复制文件使用MSBuilld命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VS 2012年我试图复制使用VS 2012新出版的配置文件和文件的MSBuild源代码控制设置在Azure上使用TFS asp.net网站在线。看完这篇文章<一个href=\"http://www.diaryofaninja.com/blog/2012/08/26/visual-studio-2012-web-deployment-projects-are-dead-ndash-long-live-publishing-profiles\"相对=nofollow>的Visual Studio 2012 Web部署项目都死了 - 万岁出版个人资料,其中道格说,你可以用你的发布配置文件生成脚本

I've set up asp.net website on Azure with TFS online for source control using VS 2012. I'm trying to copy files using VS 2012 new publishings profiles and MSBuild. Reading this article Visual Studio 2012 Web Deployment Projects are Dead – Long Live Publishing Profiles, in which Doug says you can use build scripts in your publishing profile.

所以我设置一个测试,在我的.csproj我本地建筑工作。我只是简单地复制从根目录到CSS目录下的robots.txt文件。下面是我的测试。我把我的pubxml在TFS生成过程下> 6.发布流程模板 - Azure的网站,Web部署Pubish简介

So I setup a test that works in my .csproj on my local build. I'm just simply copying the robots.txt file from the root directory to the css directory. Here is my test. I set my pubxml in the TFS Build Process template under process > 6. Publishing -- Azure Website, Web Deploy Pubish Profile.

<Target Name="AfterBuild">
    <Copy SourceFiles="$(ProjectDir)robots.txt" DestinationFolder="$(ProjectDir)css\" />
</Target>

我放弃了这个code到我我pubxml文件,我得到一个大罢了。我究竟做错了什么?
是否有可能复制afterbuild在Azure上的文件?

I dropped this Code into my my pubxml file and I get a big nothing. What am I doing wrong? Is it possible to copy files afterbuild on Azure?

其他信息

日志文件包含这些行,所以我敢肯定,发布配置文件正在运行。

The log file contains these lines so I'm sure the publishing profile is running.

AfterBuild:
  Creating directory "C:\a\src\...\css".
  Copying file from "C:\a\src\...\robots.txt" to "C:\a\src\...\css\robots.txt".

下面是构建步骤Azure中的默认编译模板使用:

Here are the build steps that Azure's default build template uses:


  1. ValidateSolutionConfiguration:

  2. prepareForBuild:

  3. CoreCompile:

  4. _CopyFilesMarkedCopyLocal:

  5. CopyFilesToOutputDirectory:

  6. GenerateTargetFrameworkMonikerAttribute:

  7. CoreCompile:

  8. _CopyFilesMarkedCopyLocal:

  9. CopyFilesToOutputDirectory:

  10. _CopyWebApplicationLegacy:

  11. ValidateGlobalPackageSetting:

  12. Col​​lectFilesFromIntermediateAssembly:

  13. Col​​lectFilesFromContent:

  14. Col​​lectFilesFromIntermediateSatelliteAssembliesWithTargetPath:

  15. Col​​lectFilesFromReference:

  16. Col​​lectFilesFromAllExtraReferenceFiles:

  17. Col​​lectFilesFrom_binDeployableAssemblies:

  18. PipelineCollectFilesPhase:

  19. ExcludeGeneratedDebugSymbol:

  20. preTransformWebConfig:

  21. TransformWebConfigCore:

  22. PostTransformWebConfig:

  23. preProfileTransformWebConfig:

  24. PipelineTransformPhase:

  25. ProcessPublishDatabaseSettings:

  26. preAutoParameterizationWebConfigConnectionStrings:

  27. AutoParameterizationWebConfigConnectionStringsCore:

  28. PostAutoParameterizationWebConfigConnectionStrings:

  29. PipelineMsdeploySpecificTransformPhase:

  30. ValidatePublishProfileSettings:

  31. CopyAllFilesToSingleFolderForMsdeploy:

  32. PipelineCopyAllFilesToOneFolderForMsdeploy:

  33. 包装方式:

  34. GenerateMsdeployManifestFiles:

  35. PackageUsingManifest:

  36. GenerateSampleDeployScript:

  37. PipelineDeployPhase:

  38. AfterBuild:

  1. ValidateSolutionConfiguration:
  2. PrepareForBuild:
  3. CoreCompile:
  4. _CopyFilesMarkedCopyLocal:
  5. CopyFilesToOutputDirectory:
  6. GenerateTargetFrameworkMonikerAttribute:
  7. CoreCompile:
  8. _CopyFilesMarkedCopyLocal:
  9. CopyFilesToOutputDirectory:
  10. _CopyWebApplicationLegacy:
  11. ValidateGlobalPackageSetting:
  12. CollectFilesFromIntermediateAssembly:
  13. CollectFilesFromContent:
  14. CollectFilesFromIntermediateSatelliteAssembliesWithTargetPath:
  15. CollectFilesFromReference:
  16. CollectFilesFromAllExtraReferenceFiles:
  17. CollectFilesFrom_binDeployableAssemblies:
  18. PipelineCollectFilesPhase:
  19. ExcludeGeneratedDebugSymbol:
  20. PreTransformWebConfig:
  21. TransformWebConfigCore:
  22. PostTransformWebConfig:
  23. PreProfileTransformWebConfig:
  24. PipelineTransformPhase:
  25. ProcessPublishDatabaseSettings:
  26. PreAutoParameterizationWebConfigConnectionStrings:
  27. AutoParameterizationWebConfigConnectionStringsCore:
  28. PostAutoParameterizationWebConfigConnectionStrings:
  29. PipelineMsdeploySpecificTransformPhase:
  30. ValidatePublishProfileSettings:
  31. CopyAllFilesToSingleFolderForMsdeploy:
  32. PipelineCopyAllFilesToOneFolderForMsdeploy:
  33. Package:
  34. GenerateMsdeployManifestFiles:
  35. PackageUsingManifest:
  36. GenerateSampleDeployScript:
  37. PipelineDeployPhase:
  38. AfterBuild:

所以看起来天青在31 CopyAllFilesToSingleFolderForMsdeploy的步骤打包的所有文件了。这样看来,在AfterBuild步运行后复制是晚了。让我感动的复制命令到目标BeforeBuild,但文件仍没有在CopyAllFilesToOneFolderForMsdeploy步结束了。

So it looks like Azure packages all the files up during the "31. CopyAllFilesToSingleFolderForMsdeploy" step. It would appear that running copy during the AfterBuild step is to late. I moved the Copy command to the target "BeforeBuild" but the files are still not ending up in the CopyAllFilesToOneFolderForMsdeploy step.

推荐答案

感谢赛义德·易卜拉欣·哈希米为他的文章的如何COM preSS CSS / JavaScript的前发布/包帮助我解决这个问题。

Thanks to Sayed Ibrahim Hashimi for his article How to compress CSS/JavaScript before publish/package for helping me solve this.

这是可能的直接复制包Temp目录。我结束了加入这个目标我的发布配置文件(pubxml)文件。在CopyAllFilesTOSingleFolderForMsdeploy这一步完成后这一步将运行将从该解决方案为您指定的destinationfolder的一部分复制文件。

It's possible to copy directly Package Temp Directory. I ended up adding this target to my publishing profile (pubxml) file. After the "CopyAllFilesTOSingleFolderForMsdeploy" step finishes this step will run which will copy a file from one part of the solution into the destinationfolder you specify.

<Target Name="AdditionalFilesForPackage" AfterTargets="CopyAllFilesToSingleFolderForMsdeploy">
    <Copy SourceFiles="$(ProjectDir)robots.txt" DestinationFolder="$(_PackageTempDir)\css\" />  
</Target>

这篇关于VS 2012的发布配置文件和复制文件使用MSBuilld命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆