SlowCheetah not transforming file on build
Asked Answered
Z

8

32

I have a project I am trying to use SlowCheetah for. I have created my config file (Test.web.config) and all the transformations I want to use (Debug_Mock.config, Debug_SQL.config, Release) in my Build configuration I have a post-build event is supposed to copy the transformed file into another directory but the file cannot be found

(error xcopy exited with code 4)

SlowCheetah doesn't seem to be transforming the file and placing it in the output directory (bin folder) like I would expect. Does anyone have any ideas as to why it is not happening, maybe a setting somewhere?

FYI: This process works on another machine, with the same project. As far as I can tell the same set up as well. But I may not be looking in the correct place.

Ziegfeld answered 21/11, 2012 at 19:37 Comment(2)
non of the solutions below worked for me :( did u get it to work in the end?Cent
None of the below solutions worked for me too. The changes did not appear even in the preview for me.Comber
C
11
  • Enable build verbosity (Tools -> Options -> Projects and Solutions -> Build and Run) and see the difference between the version that is working and the one that is not.

  • To my knowledge, slow-Cheetah supports config transforms for the app.config files but not web.configs on debug at present. It should put a transformed web.config file in the bin folder of your project but your project still reads from the config file in the root folder. Please have a look at pre/post build events at http://sedodream.com/CommentView,guid,68b7e248-b9f5-4d07-bdfe-eb037bcf2cbb.aspx.

  • You can request for web config transform support on debug at
    https://github.com/sayedihashimi/slow-cheetah/issues/39

  • Try re-installing Slow-Cheetah.

Cummine answered 28/11, 2012 at 3:45 Comment(5)
This is marked as answered, but which step(s) fixed the problem?Ichnite
@TravisParks For me, I had installed SlowCheetah from visualstudiogallery.msdn.microsoft.com/… which let me do the Add Transform and Preview Transform, but wouldn't change the output config. Then I installed SlowCheetah from nuget and it worked.Daystar
@ChrisCameron just installed SlowCheetah on VS2013 Up5 from the website. Preview works but it won't be transform while building. Installing from Nuget fixes that. Thanks!Stellate
Thanks. Wasted many hours. Finally, uninstalling the extension and installing from nuget fixed it!Khalilahkhalin
take a look at the csproj/vsproj answer below, this answer did not fix my problem, but adding the propertygroup didPrelature
B
33

For me I found the issue was that the slow cheetah property group in the config file was below the section where it checked if it existed.

So the fix was simply to move the property group above that line somewhere which would allow the transform to run as expected.

Put this:

<PropertyGroup Label="SlowCheetah">
  <SlowCheetahToolsPath>$([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\..\packages\SlowCheetah.2.5.10.3\tools\))</SlowCheetahToolsPath>
  <SlowCheetah_EnableImportFromNuGet Condition=" '$(SC_EnableImportFromNuGet)'=='' ">true</SlowCheetah_EnableImportFromNuGet>
  <SlowCheetah_NuGetImportPath Condition=" '$(SlowCheetah_NuGetImportPath)'=='' ">$([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\Properties\SlowCheetah\SlowCheetah.Transforms.targets ))</SlowCheetah_NuGetImportPath>
  <SlowCheetahTargets Condition=" '$(SlowCheetah_EnableImportFromNuGet)'=='true' and Exists('$(SlowCheetah_NuGetImportPath)') ">$(SlowCheetah_NuGetImportPath)</SlowCheetahTargets>
</PropertyGroup>

Above this:

<Import Project="$(SlowCheetahTargets)" Condition="Exists('$(SlowCheetahTargets)')" Label="SlowCheetah" />
Bradway answered 24/11, 2013 at 20:46 Comment(6)
This fixed it for me; I'm using SlowCheetah 2.5.10.3 via NuGet, and my App.config file was not being transformed. I swapped the order of the two elements above and it started working.Policlinic
Having fixed this locally as above, builds started failing on our Jenkins build server as others have noted here: github.com/sayedihashimi/slow-cheetah/issues/114. The fix was to adjust the version of SlowCheetah in SlowCheetah.transforms.targets to the correct 2.5.10.3 version.Policlinic
This fixed it for me. I am using SlowCheetah 2.5.14Fructify
This fixed it for me. Neither the PropertyGroup nor the Import had been added to my project's vbproj file. Additionally I did update the version number in the SlowCheetahToolsPath elementIrritate
what property group in whatg config file??Feaze
@Feaze the csproj/project file that you added SlowCheetah toBradway
Q
16

Check in your Project, if there exists a folder named SlowCheetah containing the file SlowCheetah.Transforms.targets. If this file is missing, try the following steps:

  1. right click on solution
  2. "Manage NuGet Packages for Solution...", browse for SlowCheetah
  3. click on "Manage"
  4. deselect your project and click "Ok"
  5. click on "Manage" again
  6. select your project and click once more "Ok"

This will recreate the missing file.

Quarta answered 14/1, 2014 at 14:4 Comment(3)
This was it for me. I installed from visualstudiogallery.msdn.microsoft.com/… which didn't create the folder. So I got Add/Preview but the transform wouldn't actually happenDaystar
SlowCheetah folder is created under Properties folder.Trude
this works for me, things turns out that we just install vs plugin, forget to install nuget package.Thanks ThorstenLepidus
C
11
  • Enable build verbosity (Tools -> Options -> Projects and Solutions -> Build and Run) and see the difference between the version that is working and the one that is not.

  • To my knowledge, slow-Cheetah supports config transforms for the app.config files but not web.configs on debug at present. It should put a transformed web.config file in the bin folder of your project but your project still reads from the config file in the root folder. Please have a look at pre/post build events at http://sedodream.com/CommentView,guid,68b7e248-b9f5-4d07-bdfe-eb037bcf2cbb.aspx.

  • You can request for web config transform support on debug at
    https://github.com/sayedihashimi/slow-cheetah/issues/39

  • Try re-installing Slow-Cheetah.

Cummine answered 28/11, 2012 at 3:45 Comment(5)
This is marked as answered, but which step(s) fixed the problem?Ichnite
@TravisParks For me, I had installed SlowCheetah from visualstudiogallery.msdn.microsoft.com/… which let me do the Add Transform and Preview Transform, but wouldn't change the output config. Then I installed SlowCheetah from nuget and it worked.Daystar
@ChrisCameron just installed SlowCheetah on VS2013 Up5 from the website. Preview works but it won't be transform while building. Installing from Nuget fixes that. Thanks!Stellate
Thanks. Wasted many hours. Finally, uninstalling the extension and installing from nuget fixed it!Khalilahkhalin
take a look at the csproj/vsproj answer below, this answer did not fix my problem, but adding the propertygroup didPrelature
I
7

After a reinstall as described above, I needed to add the subType and transformOnBuild nodes to my csproj file, and it started working for me.

<None Include="App.config">
  <SubType>Designer</SubType>
  <TransformOnBuild>true</TransformOnBuild>
</None> 
<None Include="App.QA.config">
  <DependentUpon>App.config</DependentUpon>
  <IsTransformFile>True</IsTransformFile>
</None>
Immolate answered 15/12, 2016 at 20:30 Comment(0)
M
7

Please Note, you have to install the SlowCheetah Visual studio extension AND the SlowCheetah nuget package for the project in question for the transformation to work.

Marduk answered 11/2, 2017 at 1:53 Comment(1)
important distinction between extension and package. I needed both for transformation.Hanse
W
3

With SlowCheetah 2.5.15 and Visual Studio 2015, I had to uninstall the nuget package and then manually remove the following from the relevant .csproj file:

<Import Project="$(SlowCheetahTargets)" Condition="Exists('$(SlowCheetahTargets)')" Label="SlowCheetah" />

and

<PropertyGroup Label="SlowCheetah">
  <SlowCheetahToolsPath>$([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\..\packages\SlowCheetah.2.5.15\tools\))</SlowCheetahToolsPath>
  <SlowCheetah_EnableImportFromNuGet Condition=" '$(SlowCheetah_EnableImportFromNuGet)'=='' ">true</SlowCheetah_EnableImportFromNuGet>
  <SlowCheetah_NuGetImportPath Condition=" '$(SlowCheetah_NuGetImportPath)'=='' ">$([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\Properties\SlowCheetah\SlowCheetah.Transforms.targets ))</SlowCheetah_NuGetImportPath>
  <SlowCheetahTargets Condition=" '$(SlowCheetah_EnableImportFromNuGet)'=='true' and Exists('$(SlowCheetah_NuGetImportPath)') ">$(SlowCheetah_NuGetImportPath)</SlowCheetahTargets>
</PropertyGroup>

Once this was done and the SlowCheetah nuget package was reinstalled, my problem was resolved.

Wichern answered 8/7, 2016 at 16:49 Comment(0)
H
3

SlowCheetah 3.2.20 added a, uhh, "feature", designed to respect the "Do Not Copy" file setting in Visual Studio. So if you don't have your .config file set to "Copy Always" or "Copy if Newer", it won't copy them to the output folder.

See https://github.com/Microsoft/slow-cheetah/issues/182 for some details.

This was my issue - spent three hours debugging it...

Hogshead answered 20/2, 2019 at 20:51 Comment(0)
D
0

For me, the App.config transformation WAS working. Just that the output is not App.config. It's actually appname.exe.config. In fact I turned off the copying of app.config to the app build output folder, so as not to confuse others. The appname.exe executable picks up the configurations from appname.exe.config.

Decease answered 10/12, 2022 at 20:14 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Wowser

© 2022 - 2024 — McMap. All rights reserved.