0

I am trying to set different artifact paths configuration wise. e.g

In general settings of teamcity I am specifying following artifact paths:

testing\obj\Deploy-Dev\package
testing\obj\Deploy-Test\package
testing\obj\Deploy-Live\package

But when I am publishing a site using the following:

/M /P:Configuration=%env.Configuration% /P:DeployOnBuild=True/P:DeployTarget=MSDeployPublish /P:MsDeployServiceUrl=%env.TargetServer%/MsDeployAgentService /P:DeployiisAppPath=%env.IISPath% /P:MSDeployPublishMethod=RemoteAgent /P:CreatePackageOnPublish=True /P:Username=%env.username% /P:Password=%env.password%

In this step I am using only 1 configuration. I am assuming that by specifying these artifact paths. it will also transform the web configs according to specified configuration. But it is only transforming the one specified while actually packaging.

Any idea how to have web configs transformed in all packages as well.

3 Answers 3

1

I am not sure if I fully understand your question but here is what I think that you are asking. "How can I create a web package which has all the web.config transforms required so that I can publish the same package to multiple different environments?"

Unfortunately the way that packaging works is that the web.config is transformed using the web.config transform of the build configuration which is being built. Then the transformed web.config file makes it into the package. The transform files are not packaged.

I do realize that it's important to create a single package and publish that to different locations. We were not able to build the features into the box but I have created a NuGet package, PackageWeb, which can help in this case. I have a 5 minute video posted at http://sedodream.com/2012/03/14/PackageWebUpdatedAndVideoBelow.aspx which you can take a look at. I am fairly certain that it will help in your scenario. FYI the code for package-web is open source at https://github.com/sayedihashimi/package-web. We do have some known issues. If you do end up using this please do let me know.

3
  • I watched the video and was wondering how you would integrate this in a automated build for TFS? Or would you just build all configurations in the build definition settings. What is considered best practice? Jun 22, 2012 at 4:35
  • Its pretty easy to automate. Take a look starting at 4:25 in the video. You can create a .ps1 file which has the configuration (by default it automatically looks for a file named PublishConfiguration.ps1. To automate the publish process from TFS you will use powershell.exe to invoke the script. And to use a config file with a name different from PublishConfiguration.ps1 you will just pass a different file path as a parameter when you use powershell.exe. Jun 22, 2012 at 6:02
  • Thanks. This is good stuff. If I have any more questions reagarding this I will post them on your blog. Jun 22, 2012 at 17:03
0

Try setting a environment variable for your teamcity artifact path.

testing\obj\%env.Configuration%\package

Troy Hunter -You're deploying it wrong! TeamCity, Subversion & Web Deploy part 5: Web Deploy with TeamCity

0

Artifact paths do not affect build\packaging process anyhow. They just provide ability to keep some files\folders available after build for further access.

If you want to produce 3 different packages, you will need to specify 3 corresponding build steps in your configuration and get rid of '%env.Configuration%'.

5
  • The env.configuration variable would allow the build configuration to be set on demand and the package placed in that artifact location. Jun 22, 2012 at 3:58
  • @SoftwareCarpenter, Yes, I'm aware of %env.configuration% and it's purpose. But if I understand correctly, the post owner wants to produce 3 different packages using a single build on TeamCity, since he made an assumption: "I am assuming that by specifying these artifact paths. it will also transform the web configs according to specified configuration.". If this is the case, then it's not clear, why we need a %env.configuration%, because what we actually need is just to hard-code 3 configuration names. Again, I'm not sure, that I fully understand the question :) Jun 22, 2012 at 6:11
  • I agree with you. My full comment got cut off. I think it is either calling it 3 times or using Sayed Ibrahim Hashimi solution. Regardless the question is kind of confusing. Jun 22, 2012 at 16:33
  • @s.ermakovich, Yes this is what I want to do. Instead of just creating a package, i want all the web configs to be transformed as well. e.g for dev, test and live configs. If I just use 1 configuration then it only transforms that particular web config. please do guide me If you know any other way to push the publishes configuration wise. Really sorry for being confusing.
    – sam
    Jun 25, 2012 at 10:43
  • Look at troyhunt.com/2010/11/you-deploying-it-wrong-teamcity_26.html and the part about "Passing parameters to the build and deploying to other environments" it will allow you to create the 3 packages by passing a parameter and calling the build from Team City. Otherwise you will need to create your own msbuild .proj that is called and calls the transforms for the environments you need. Jun 25, 2012 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.