MSBuild - perform all configuration conversions at once - and convert other files

I am working on a build script for a website that we have. A website is a classic asp web application with an asp.net website in the classic asp web application folder.

We have different versions of global.asa that need to be replaced instead of different web config. We are in the process of moving towards the continuous integration environment that is so important to me. I have written an assembly script that does the following tasks.

  • Cleans up the buildartifacts directory, if it exists.
  • Creates a solution file with any configuration passed to. This creates an output with each project in a separate folder.
  • Copies files to the required folder structure.
  • Packs the result using MSDeploy as sync.

My first problem is ...

When I run the MSBuild task like this ...

<MSBuild Projects="$(SolutionFileName)" 
         Properties="Configuration=$(Configuration);OutDir=%(BuildArtifacts.FullPath)" />

      

It builds the web application but does not apply any transformations. I would assume MSBuild will apply the transforms automatically. Instead, I get all 3 config files in the output folder containing the assembly. Why is this? I did a search here and here and they use a separate task to perform the conversion. IF Visual Studio can apply transforms and Visual Studio uses MSBuild. I would have thought MSBuild could apply transform? Does the MSBuild config don't know? Also, if I need to do it separately, can I do all the conversions at once if there are multiple config files in multiple folders at each level of the folder structure.

My second problem is that ... being a classic asp web app we can't use config files for this part because ... well I'm not sure how a classic asp web app will access the config file ? Thus, we have different versions of the global.asa file, which are usually replaced manually. I suppose I could do some sort of search / copy for the specific asa files we need at the time, but is there a way to use transforms to accomplish this task?

+3


source to share


2 answers


As for the question of conversions ... once we figured out deploying with msdeploy, we figured out that msdeploy would actually do the conversions when deployed. It stores transformation data in one of the xml files that are generated along with the package.



0


source


Perhaps this is not exactly what you want. I am using XmlPreprocess tool to manage configuration files. I am using one mapping file for multiple environments. You can edit the Excel mapping file. It is very easy to use.



You can call it from MSBuild script using Exec task.

0


source







All Articles