src/T4Toolbox.VisualStudio/OutputFileManager.cs
/// <summary>
/// Saves and configures the additional output created by the transformation.
/// </summary>
/// <remarks>
/// Note that this method currently cannot distinguish between files that are
/// already in a Database project and files that are simply displayed with
/// "Show All Files" option. Database project model makes these items appear
/// as if they were included in the project.
/// </remarks>
Saves and configures the additional output created by the transformation.
Saves and configures the additional output created by the transformation .
private void ConfigureOutputFile(OutputFile output)
        {
            string outputFilePath = this.GetFullPath(output.Path);
            ProjectItem outputItem = this.dte.Solution.FindProjectItem(outputFilePath);
            ProjectItems collection = this.FindProjectItemCollection(output);
            if (outputItem == null)
            {
                outputItem = collection.AddFromFile(outputFilePath);
            }
            else if (!Same(outputItem.Collection, collection))
            {
                string backupFile = outputFilePath + ".bak";
                File.Move(outputFilePath, backupFile); 
                outputItem.Delete(); 
                File.Move(backupFile, outputFilePath);
                outputItem = collection.AddFromFile(outputFilePath);
            }
            ConfigureProjectItem(outputItem, output);
        }
private void ConfigureOutputFile ( OutputFile output ) { string outputFilePath = this . GetFullPath ( output . Path ) ; ProjectItem outputItem = this . dte . Solution . FindProjectItem ( outputFilePath ) ; ProjectItems collection = this . FindProjectItemCollection ( output ) ; if ( outputItem == null ) { outputItem = collection . AddFromFile ( outputFilePath ) ; } else if ( ! Same ( outputItem . Collection , collection ) ) { string backupFile = outputFilePath + " " ; File . Move ( outputFilePath , backupFile ) ; outputItem . Delete ( ) ; File . Move ( backupFile , outputFilePath ) ; outputItem = collection . AddFromFile ( outputFilePath ) ; } ConfigureProjectItem ( outputItem , output ) ; }
Saves and configures the additional output created by the transformation.
Saves and configures the additional output created by the transformation .
// If output file has not been added to the solution // If the output file moved from one collection to another                     // Prevent unnecessary source control operations // Remove doesn't work on "DependentUpon" items
output
OutputFile
remarks
Note that this method currently cannot distinguish between files that are
already in a Database project and files that are simply displayed with
"Show All Files" option. Database project model makes these items appear
as if they were included in the project.
Note that this method currently cannot distinguish between files that are already in a Database project and files that are simply displayed with " Show All Files " option . Database project model makes these items appear as if they were included in the project .