tags:

views:

264

answers:

3

When i try to specify an absolute path for the generated files using

someTemplate.RenderToFile("c:\\tmp\\filename.ext");

I'm getting the following error

Error 263 Running transformation: System.Runtime.InteropServices.COMException (0x80004005): There is already a file of the same name in this folder.

even though the folder is empty.

A: 

Vitor,

Are you using Template.RenderToFile method from T4Toolbox? If yes, this method currently doesn't support saving files to a different folder. This has been on my to-do list for a while. What are you generating, anyway?

Oleg Sych
I built a template of the row data gateway (http://martinfowler.com/eaaCatalog/rowDataGateway.html) to use in simple asp.net webapps.And everytime i change someting in the db schema and have to generate those classes I have to manually copy them to main project... which is kinda boring...
vitorsilva
A: 

Hi Oleg,

Whenever you get around to adding this functionality to the T4Toolbox, it'd be greatly appreciated! I am currently writing a code generator that takes an XML file containing our site navigation, parses the file, and then creates all of the necessary folders and files based off of a starting .tt template. Everything works great except for the fact that the files don't get created in the remote folders :(

For now, I'm going to see if using the System.IO classes to move the files around after they are created will work, but having this support out of the (tool)box would be great!

A: 

This functionality was implemented in version 9.3 of T4 Toolbox: http://t4toolbox.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25294

Oleg Sych