slow-cheetah
slow-cheetah copied to clipboard
User specific transformation pipeline
My project har some transformation I would like to do in my environment only, but shouldn't be tracked by the source control system.
The user should be able to add by context-menu "Add user transform", then it should add the files for each configuration and update the project accordingly
<None Include="web.Debug.config.user" Condition="Exists('web.Debug.config.user')" >
<DependentUpon>web.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
</None>
if the project file contains this configuration it should only add the files.
When the transformation takes place it should first perform the transformation from the web.Debug.config first and afterwards if the user file exists it should apply those transformations on the result from the previous transform result.
This is kind of interesting and I like the concept, but I think it may be a bit confusing. What if we had a convention based approach. Say you have a file, foo.xml, which has <IsTransformFile>true</IsTransformFile>. Then if there exists a file with the name foo.release.xml.user (assuming Release was the build configuration) then execute it.
What are your thoughts? And would you be able to help develop it? :)
Sounds like a doable solution. I'll take a look on it.
If you run into any issues just let me know and I'll be glad to help.
It looks like most of the transform process is in the SlowCheetah.Task assembly, that makes it kind of hard to change the behavior to get it to it into a pipeline.
This change would not be made in the tasks assembly, that assembly just knows how to transform XML files, it doesn't know anything about any processes around it. This change would need to be made in the MSBuild .targets file (https://github.com/sayedihashimi/slow-cheetah/blob/master/SlowCheetah/Resources/Install/SlowCheetah.Transforms.targets). When the transforms are gathered we may be able to simply add all .user files to the list. I'll take a quick look at it.
I've created a new branch for this work at https://github.com/sayedihashimi/slow-cheetah/tree/UserFileSupport. I made a few changes to support this. The last change was in commit bf203f84ba55da5c63d9e33bd96427a9ef2e7398. It should now be working from that branch. I've got a build available at https://dl.dropbox.com/u/40134810/SlowCheetah/SlowCheetah-bf203f84ba.zip which has the fix. Before installing it uninstall the old version and delete the file at C:\Users\USER-NAME\AppData\Local\Microsoft\MSBuild\SlowCheetah\v1.
Can you try it out and let me know what you find? If it works then I'll merge it into the master branch.
It works, not as a pipeline as I hoped it would work. But instead of. Kind of a solution I could live with. But I still think that a solution where the project transform is first applied and then the user transform is applied would require less copying of configuration transformations.
Sorry for the late reply here. I think I understand what you mean now. The current behavior is to apply the standard config transform (i.e. app.Release.config) and if there exists app.Release.config.user, it will be applied. If I understand you correctly you are stating that this is not correct because the .user transform should be independent of the build configuration. So the user transform name should be app.config.user so that it will always be applied no matter the build configuration. Is that right?
Let me summarize in different words what I think your problem is. For example you are building in release the transform app.Release.config will be applied and then the app.Release.config.user will be applied. This is
I didn't get it to first apply app.Release.config and then app.Release.config.user from the version I tested. But it sounds like we want the same thing.
Is this still being worked on? I would love to have a solution for user transforms to stop other devs in the team making changes to the app.config file to suit their environment and then committing it back to the shared VCS and stuffing up my environment. Grrrr!
I would love to have it take app.config and then apply app.config.user followed by app.Release.config and then app.Release.config.user. So basically, the user transforms occur immediately after the shared transform for that configuration.
What you ideally want is some way to explicitly define the transform pipeline.
Web.config
+-Web.config.pipeline
<?xml version="1.0" encoding="utf-8"?>
<Transforms>
<Path>$(SolutionDir)Web.$(Configuration).config</Path>
<Path>Web.$(Configuration).config</Path>
<Path>Web.$(Configuration).config.user</Path>
</Transforms>
This would perform those 3 xml transforms on Web.config in order. This would allow us to share a transform file between multiple projects without having to share the actual xml file as well.
Thoughts?
You could also have configuration specific pipelines with
Web.config
+-Web.Debug.config.pipeline
+-Web.Release.config.pipeline
User transforms would be very useful in my environment as well. I would prefer it, however, if the file extension stayed the same and ".user" got inserted before the extension, e.g. app.user.config instead of app.config.user, to preserve file type association based on extension.