I just need the transformed web.config, is there any way just use MSBuild to get it transformed without compiling the project?
Thanks in advance!
I'm using XmlPreprocess tool for config files manipulation. It is using one mapping file for multiple environments. You can edit mapping file by Excel. It is very easy to use.
Related
We have a web.Release.config file we would like to share between multiple AspNetCore projects in the same solution. At the time of writing we have 18 apps we would like to execute the exact same set of transformations on. However just putting the web.Release.Config file in a shared project does not seem to execute the transformations.
Is there any way it can be done directly in the project/solution model, or is our only option to do some copy scripting in our CI?
i have created a Custom tool (SingleFile generator) using IVsSingleFileGenerator. Which takes "xyz.Resx" file as input and generate "xyz.Designer.resx.cs" file. This file can be generated on building/Saving the Application through IDE.
Issue is, I have given the Custom Tool Property for any .Resx file and build the application through MSBUILD. Now I am unable to build/
generate the "Designer.resx.cs" file.
How to prepare a Custom Task to run this custom tool through MSBUILD.
plz help in doing the same.
Thanks in advance.
I don't have much knowledge about this custom tool IVsSingleFileGenerator which you are using. To execute it in MSBuild you may need targets for the same given by them to generate the resx.cs file from .resx file. Or you may add a commandline call of this tool in your MSBuild script and try it.
I don't think you can run CustomTool from MsBuild. Since you're the one that wrote the tool, I would definitely suggest to create msbuild task and start using it.
Here are some ideas how to do that:
http://msdn.microsoft.com/en-us/library/t9883dzc.aspx
http://blogs.msdn.com/b/msbuild/archive/2006/01/21/515834.aspx
Another approach would be to write executable, but that will be less efficient.
Here is how you call executable from msbuild
<Target Name="your-target-name" AfterTargets="the-starting-point-of-your-target">
<Exec Command="your_exutable-here parameters_here" WorkingDirectory="your_working_folder" />
</Target>
Third approach would be to write inline msbuild task
http://blogs.clariusconsulting.net/kzu/writing-inline-msbuild-tasks-in-c-for-one-liners/
I hope that helps
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.
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.
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
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%'.
Our solution has got a ton of projects in it, and our MSBuild file is becoming a gigantic, unstable morass of angle brackets that has gotten so large that I've begun to be scared to touch it. However, I noticed that most of our projects fall into two groups.
There are web projects, which have a .csproj extension and are built and deployed using web deployment projects to dump them into a directory. There is also a configuration transform process. Basically, to deploy a web project, one only needs the project name, the output directory, and the config transforms.
Similarly, we have an ever-increasing number of service apps that will live under TopShelf. These are basically dlls that are built from .csproj files. Like the above websites, they undergo a config transform, but they are copied to the output directory instead of going through the web deployment steps.
It occurred to me that it would be really slick if I could simply provide the MSBuild project with a couple of text files (one for the webs and the other for the services) that MSBuild could then use to dynamically compile all the various projects. I was thinking that if I could just feed it a comma-delimited list of projects, output locations, and config replacement files that there might be a way to get msbuild to read them in, iterate over them, and dump out the projects where they are supposed to go.
However, my MSBuild-fu is weak. How do I even get started on this?
You can start here, this is part 2.
For config files I'm using XmlPreprocess tool for config files manipulation. It is using one mapping file for multiple environments. You can edit mapping file by Excel. It is very easy to use.
In our WCF solution we have one ConsoleHost (console application not class library) project and one WasHost Project. We use the Consolehost hosting for Dev environment and WAS hosting for production.
Now there are a number of .config files that are included using "include uri=file://services.config" in the Castle section of ConsoleHost project. I don't want to make a copy of this services.config file in the WasHost Project.
Is there a way to include files from other projects without making local copies of them? Or happy to hear other better ways of doing this.
Thanks
Ravi
You could do this a couple of ways.
One is to simply add a link to the source file from both projects as described here.
Alternatively you could embed the config into one of the common assemblies (Build Action=Embedded Resource in the file properties) and then use Castle's ability to include embedded resources. E.g.
<include uri="assembly://AssemblyName/xxx.config"/>