Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 910507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:03:22+00:00 2026-05-15T17:03:22+00:00

I’m using T4 templating to generate some .config files in a project I’m working

  • 0

I’m using T4 templating to generate some .config files in a project I’m working on.

I’ve set up a pre-build task to look for all .tt files in the solution directory, and then execute the TextTransform command-line tool, so that the code is freshly generated on each build.

However, I’m now having “Access Denied” errors because (for example) when it tries to execute TextTransform on the Web.UAT.tt file, the Web.UAT.Config file is under source-control in TFS, and thus write protected.

Ordinarily I would select the .Config file in Visual Studio, and do the File->Source Control->Exclude From Source Control thing. Unfortunately, this does not appear as an option for any file which shows up as “nested” beneath another file!

i.e. I can exclude web.tt, but not web.config… I can exclude default.aspx but not default.aspx.cs.

Does anyone have any ideas about how I can exclude the lower level nested files from Source Control, but keep the top level ones?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:03:23+00:00Added an answer on May 15, 2026 at 5:03 pm

    I’m assuming you’re using TFS here.

    You’re not going to be able to do this perfectly – since Visual Studio will automatically add any new item added to a project to source control. Your best solution is to look at using MSBuild and issuing a checkout for the output file before running the template (but then you’ll likely have to check-in again afterwards). Having a quick look there is http://msbuildextensionpack.codeplex.com/ which I’ve seen mentioned for the purposes of doing this.

    Failing that, there is another way.

    • Delete from source-control the output .config file and check in (best to use Source Control Explorer for this).
    • Run the .tt manually from within VS, it’ll add the file again – it should now have a plus sign next to it.
    • Again in Source Control explorer, right click on this ‘new’ file and select ‘Undo Pending Changes’. You now have the file on disk, but not in source control.
    • Now the TT can be run, the file is part of the project (and therefore will get published or whatever), but it’s not under source control.

    The problem with this will be somebody else loading the project for the first time, their Visual Studio will automatically create the output file if they run the .TT – in that case, they would either need to repeat this process (from step 2) or would need to manually create a stub .config file of the correct name (I would suggest before even loading the project) so that the project sees it and doesn’t attempt to re-source-control it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.