简体   繁体   中英

MSBuild Web service package deployment with separate web.config files

We are trying to deploy a web service via MSbuild and then using MSDeploy to push the service to the IIS server. Based on the different environments we have separate config files that need to be referenced based on where they reside using . The problem is when the package is created the other web..config files don't get package. I've tried using

<CopyAllFilesToSingleFolderForPackageDependsOn>
 CustomCollectFiles;
 $(CopyAllFilesToSingleFolderForPackageDependsOn);
 </CopyAllFilesToSingleFolderForPackageDependsOn>

Combined with

<Target Name="CustomCollectFiles">
 <ItemGroup>
  <FilesForPackagingFromProject Include="*.config">
     <DestinationRelativePath>%(Filename)%(Extension)</DestinationRelativePath>
   <FilesForPackagingFromProject>
  </ItemGroup>
</Target> 

But It doesn't seem to copy the files over. Am I doing something wrong or is my option to turn these in to Transform Files?

I'm using XmlPreprocess tool for config files manipulation. I'm using one mapping file for multiple environments. You can edit mapping file by Excel. It is very easy to use.

You can call it from MSBuild script using Exec task.

愚蠢的我,我从未尝试过仅重命名文件...只要配置文件不是以Web MSBuild开头的,便会将文件复制到程序包中并且不假定其是转换文件

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM