Comments (12)
There is two aspects to this:
- Support for to transform the when the web project is packaged/published
- UI support to add profile specific transforms when the Add Transform command is invoked
I'll most likely deliver them separately with the UI support coming after the build support.
The build support will be implemented in the same way that web.config transforms are applied.
file.conifg -> file.{BuildConfig}.config -> file.{Profile}.config
If the transform files are missing obviously they will simply be skipped.
from slow-cheetah.
OK I have a fix for the underlying build/publish support. Can you try it out? Follow these steps:
- Close all instances of VS both 2010 and 2012
- Copy the file from https://dl.dropbox.com/u/40134810/SlowCheetah/issue-46/SlowCheetah.Transforms.targets to C:\Users{USERNAME}\AppData\Local\Microsoft\MSBuild\SlowCheetah\v1
Since I have not added support for the UI in VS yet you'll have to add the file to the project manually. Do that by the following.
- Create the file in the correct location
- Open the project file (.csproj/.vbproj) in an editor (if you use VS just chose File->Open File)
- Locate the build config transforms in the proj file by searching for the file name
- Copy the element and replace the Include value to the publish profile specific file name. For example:
<None Include="connectionStrings.ToPkg.config">
<DependentUpon>connectionStrings.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
<SubType>Designer</SubType>
</None>
You can see how I did this in the samples at https://github.com/sayedihashimi/slow-cheetah/blob/master/SlowCheetah.Samples/WebDemo/WebDemo.csproj#L97.
After that publish/package your web project and see if the transform is applied.
Can you let me know what you find out?
from slow-cheetah.
Sure, no problem. I'll let you know what I find.
from slow-cheetah.
So I did the following:
- Closed all VS instances
- Backed up the SlowCheetah.Transforms.targets in C:\Users\AppData\Local\Microsoft\MSBuild\SlowCheetah\v1
- Copied the file at the dropbox link to the same folder, and named it SlowCheetah.Transforms.targets
- Edited the csproj for the test web project (the one we sent you previously). We already had transform files added for a couple of publish profiles so the syntax for the transform file in the csproj was already pretty much what you describe, except I had to add Designer... (not sure if that matters)
- Open the project in VS2012
- Right Click --> Publish, selected the publish profile (ColorWebPublishZip), selected WebDeployPackage as the publish method
- Inspected the generated ZIP file and found the AppSettings.config does not contain the changes
for the publish profile, it does however contain the Release transform settings.
Same applies to the ConnectionStrings.config transforms.
So I double checked everything, only difference between my csproj and the one you posted here was the transform deltas in your examples were in separate ItemGroup to the file they were dependent on. So I moved the AppSettings transform files into a separate itemgroup and tried again. Same result.
I have send you a copy of the project, the package created by the publish command and the targets file I have in my SlowCheetah\v1 folder just in case.
Perhaps I'm missing something somewhere?
Let me know if you want me to try something else.
from slow-cheetah.
It looks like its working on my machine. Let me finish up the support and I'll create a new VS extension which you can try out. I think one of the manual steps is what is likely to be the culprit here.
from slow-cheetah.
OK I think I got it figured out. Can you uninstall SlowCheetah and then re-install from https://dl.dropbox.com/u/40134810/SlowCheetah/issue-46/SlowCheetah-issue-46.zip and let me know if it works for you. I now have the tooling to create the publish profile specific transforms so no editing of the .csproj required.
Technical notes
I was just testing from the command line and I was using the PublishProfile property. This property is not passed in via the UI. Instead WebPublishProfileFile is passed in and it contains the full path to the profile. Using PublishProfile should be avoid in any case because it can be either a profile name or a full path so WebPublishProfileFile is better because it will always have a full path.
from slow-cheetah.
Tested using the attached vsix/zip, both AppSettings and Connectionstring config files are transformed successfully based on a publish profile! Also, transforms appear to be chained correctly where a build config (release) transform is applied followed by a publish profile transform.
Awesome! We'll start using this immediately. Thanks Sayed for implementing this so quickly, much appreciated!
from slow-cheetah.
Works like a charm, awesome!
from slow-cheetah.
OK cool, I will close this item. The feature will be included in the next release. I'm not sure when that will be but the vsix in the link above will stay there for anyone who needs it.
from slow-cheetah.
Is there any way to turn this feature off? Every time I generate a new transform for a solution config I have to clean up dozens of unwanted 'profile' transforms that someone seemed to think we wanted. It's been driving me bananas. I just want an option to kill a feature which tests my sanity at least once a month. There are already some options for Slow Cheetah, maybe one more makes sense. Also, this does not behave like Visual Studio's web.config support for creating transforms, VS does not create a bunch of 'publish' transforms, and SlowCheetah does nothing to change that behavior. There's a difference between "supported" and "promoted by tooling", this exposes something that was in no way originally "promoted by tooling" (again, VS doesn't do this for web.config.)
from slow-cheetah.
@wilson0x4d You sound a bit arrogant imo...
from slow-cheetah.
Hi @wilson0x4d thanks for the comments.
I'm aware of how the web.config profile transforms work, I designed that feature :) It doesn't make sense to compare the SC "Add Transform" command to the web.config profile. In the web.config profile transform case you right click on the publish profile (i.e. myprofile.pubxml) and then the transform (web.myprofile.config
) is created for web.config. So there is a 1:1 relationship between the profile and the transform. In the SlowCheetah case you can transform any file, not just web.config or app.config. So there is no way of knowing which file(s) to create the transforms for.
While developing the feature I saw the following high level options.
- Create transforms for each publish profile
- Have the user select which profile(s) to create transforms for
The assumptions that I had were the following.
- Most projects will have a small set of publish profiles (~3)
- If you transform values for one profile odds are you want to transform that same value in other transforms
Based on that I chose the first option, to create transforms for each publish profile. For the case where the user does not want those transforms they can simply delete them.
Unfortunately the tool is not optimized for your case. I apologize for that. I'm not developing these features for any specific person, but for the most commonly used case.
You are the only person who has requested this feature so I do not believe there is enough interest for me to prioritize this. You could create a new entry at http://slowcheetah.uservoice.com/ to see how many others are interested in it. Or you could send me a pull request with the implementation. If the code quality is good I will certainly process the PR. The code that you need to update is at https://github.com/sayedihashimi/slow-cheetah/blob/master/SlowCheetah/SlowCheetahPackage.cs#L377.
from slow-cheetah.
Related Issues (20)
- VS 2017 extenstion should auto upgrade SlowCheetah NuGet HOT 1
- Add Transform would throw memory exception HOT 2
- Inconsistent line endings on generated transformation files HOT 1
- Doesn't work in WPF HOT 2
- SlowCheetah.Samples need to be updated HOT 1
- Package Not loading VS2012 HOT 5
- Transforms don't apply during build in Visual Studio 2015 HOT 4
- Share Transformation Files HOT 2
- "Add Transform" not appearing in VS2015 HOT 3
- unable to add transforms to web.config file
- Support for publishing on .NET Core HOT 2
- Support MSbuild variables in transforms? HOT 5
- Reminding me of wrong version HOT 3
- TeamCity build (MSBuild) - cannot delete nuget from packages folder - files in use HOT 1
- Transform is not applied when publishing a console application as an Azure Web Job HOT 2
- Warning that I do not have correct version of SlowCheetah nuget package installed HOT 1
- This repository is now depracated HOT 2
- Compilation error: src\Zen.Databases.DbUp\Zen.Databases.Db.csproj in teamcity HOT 2
- Consider to add support other config file,expect release.debug config file. HOT 1
- 'Preview Transform' does nothing when selected. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slow-cheetah.