GithubHelp home page GithubHelp logo

Comments (12)

sayedihashimi avatar sayedihashimi commented on July 28, 2024

There is two aspects to this:

  1. Support for to transform the when the web project is packaged/published
  2. 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.

sayedihashimi avatar sayedihashimi commented on July 28, 2024

OK I have a fix for the underlying build/publish support. Can you try it out? Follow these steps:

  1. Close all instances of VS both 2010 and 2012
  2. 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.

  1. Create the file in the correct location
  2. Open the project file (.csproj/.vbproj) in an editor (if you use VS just chose File->Open File)
  3. Locate the build config transforms in the proj file by searching for the file name
  4. 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.

danielrolfe avatar danielrolfe commented on July 28, 2024

Sure, no problem. I'll let you know what I find.

from slow-cheetah.

danielrolfe avatar danielrolfe commented on July 28, 2024

So I did the following:

  1. Closed all VS instances
  2. Backed up the SlowCheetah.Transforms.targets in C:\Users\AppData\Local\Microsoft\MSBuild\SlowCheetah\v1
  3. Copied the file at the dropbox link to the same folder, and named it SlowCheetah.Transforms.targets
  4. 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)
  5. Open the project in VS2012
  6. Right Click --> Publish, selected the publish profile (ColorWebPublishZip), selected WebDeployPackage as the publish method
  7. 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.

sayedihashimi avatar sayedihashimi commented on July 28, 2024

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.

sayedihashimi avatar sayedihashimi commented on July 28, 2024

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.

danielrolfe avatar danielrolfe commented on July 28, 2024

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.

kipusoep avatar kipusoep commented on July 28, 2024

Works like a charm, awesome!

from slow-cheetah.

sayedihashimi avatar sayedihashimi commented on July 28, 2024

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.

wilson0x4d avatar wilson0x4d commented on July 28, 2024

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.

kipusoep avatar kipusoep commented on July 28, 2024

@wilson0x4d You sound a bit arrogant imo...

from slow-cheetah.

sayedihashimi avatar sayedihashimi commented on July 28, 2024

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.

  1. Create transforms for each publish profile
  2. Have the user select which profile(s) to create transforms for

The assumptions that I had were the following.

  1. Most projects will have a small set of publish profiles (~3)
  2. 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.