Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transformed App.config files in a subfolder for a project are not copied to the solution output folder #111

Open
JonathanLydall opened this issue Oct 10, 2013 · 3 comments

Comments

@JonathanLydall
Copy link

When an app.config file is in a subfolder, its transformed content is not copied to the output directory, however, files with a name other than app.config (EG: Other.config) are.

Steps to reproduce:

  • Create a new solution, for example a console application
  • Create a sub-folder, for example "SubFolder"
  • Add two config files to the subfolder, one called App.config and the other called something else (EG: Other.config).
  • Set the "Copy to Output Directory" properties of both config files to "Copy if newer"
  • Add transforms to each config file.
  • Add base content for each config file, EG:
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <appSettings>
        <add key="TargetKey" value="Untransformed"/>
      </appSettings>
    </configuration>
  • Edit the debug transforms for both config files, EG:
    <?xml version="1.0" encoding="utf-8" ?>
    <!-- For more information on using transformations 
         see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
    <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
      <appSettings>

        <add value="Transformed - Great!"
             xdt:Locator="XPath(//add[@key='TargetKey'])"
             xdt:Transform="SetAttributes(value)"/>

      </appSettings>
    </configuration>
  • Build the solution
  • Observe that Other.config was correctly transformed while app.config was not.
@sayedihashimi
Copy link
Owner

Thanks for the info. Is it common to have app.config in sub folders like this? I have to special case app.config so I'd rather not update that.

@JonathanLydall
Copy link
Author

I would guess this is a very rare situation, certainly a first in my experience and not one I foresee happening again. In our case we pretty much immediately guessed the problem and renaming the config files from app.config to something else was a non-issue.

So, while it could be considered a "nice to have" feature, I feel that if there is an elegant way for you to make this work, it would make SlowCheetah just that little more "complete". I leave it up to you to whether or not you feel this is worth doing.

Regardless, kudos and many thanks to you for SlowCheetah which we find very useful.

@sayedihashimi
Copy link
Owner

Hi Jonathan I agree that ideally we should fix this. With that said based on your response it seems like this is not very likely, and easy to figure out when you run into it.
This is a side project for me (i.e. I have to work on it at nights) so I have to prioritize items that I work on. I won't address this issue at this time.

Let's keep this issue open so that if anyone else is interested in fixing it and sending a PR for it. If I do get a PR to fix this issue which works well I will integrate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants