TextIO exception even with PreserveExistingFile set to false

Dec 16, 2010 at 10:21 PM

I am receiving the below IO exception when I set PreserveExistingFile to false in output.  I receive this error whether the PreserveExistingFile is set to true or false.   The code I use looks like:

EntityValidator t = new EntityValidator();
t.ObjectType = type;
t.Output.Project = @"..\..\Services\Services.csproj";
t.Output.File = @"Validators\ValidatorsForEntities\" + t.ObjectType.Name + "EntityValidator.cs";
t.Output.PreserveExistingFile = preserve;
t.Render();

Everything works fine if I go through and manually delete all the files but it occurs if I do not delete all of them.  This whole setup was working perfectly but then suddenly stopped for no reason that I can discern (not that there is no cause, I just can not figure it out).  Thinking that maybe the log file got corrupt, I decided to delete it, but still no love.  Any idea?

Error 13 An Exception was thrown while running the transformation code. The process cannot continue. The following Exception was thrown:System.IO.IOException: Cannot create a file when that file already exists.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError()
at System.IO.File.Move(String sourceFileName, String destFileName)
at T4Toolbox.DteProcessor.UpdateOutputFiles(IEnumerable`1 outputFiles, Solution solution, IEnumerable`1 projects, ProjectItem template)
at T4Toolbox.DteProcessor.UpdateFiles(ICollection`1 outputFiles)
at T4Toolbox.OutputManager.UpdateFiles() 
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at T4Toolbox.TransformationContext.OnTransformationEnded(TextTransformation transformation)
at Microsoft.VisualStudio.TextTemplating71B7276CAB0A064D719D9661DDF47E63.GeneratedTextTransformation.Dispose(Boolean disposing) in c:\Projects\AppLab\Logger\AppLab.Logger.CodeGen\Services\ServicesGenerator.tt:line 18
at Microsoft.VisualStudio.TextTemplating.TextTransformation.Dispose()
at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result) 1 1


Thanks, Alex

Dec 16, 2010 at 10:33 PM

Nevermind.  I realized that the problem seemed to pop up after I installed the Tangible editor.  I just downloaded and installed the 10.10 release and all seems to be working again.