src/T4Toolbox.VisualStudio/OutputFileManager.cs
/// <summary>
/// Adds assembly references required by the project item to its containing project.
/// </summary>
Adds assembly references required by the project item to its containing project.
Adds assembly references required by the project item to its containing project .
private static void ConfigureProjectItemReferences(ProjectItem projectItem, OutputFile output)
        {
            if (output.References.Count > 0)
            {
                var project = projectItem.ContainingProject.Object as VSProject;
                if (project == null)
                {
                    throw new TransformationException(string.Format(CultureInfo.CurrentCulture, "Project {0} does not support references required by {1}", projectItem.ContainingProject.Name, projectItem.Name));
                }
                foreach (string reference in output.References)
                {
                    try
                    {
                        project.References.Add(reference);
                    }
                    catch (COMException)
                    {
                        throw new TransformationException(string.Format(CultureInfo.CurrentCulture, "Reference {0} required by {1} could not be added to project {2}", reference, projectItem.Name, projectItem.ContainingProject.Name));
                    }
                }
            }
        }
private static void ConfigureProjectItemReferences ( ProjectItem projectItem , OutputFile output ) { if ( output . References . Count > 0 ) { var project = projectItem . ContainingProject . Object as VSProject ; if ( project == null ) { throw new TransformationException ( string . Format ( CultureInfo . CurrentCulture , " " , projectItem . ContainingProject . Name , projectItem . Name ) ) ; } foreach ( string reference in output . References ) { try { project . References . Add ( reference ) ; } catch ( COMException ) { throw new TransformationException ( string . Format ( CultureInfo . CurrentCulture , " " , reference , projectItem . Name , projectItem . ContainingProject . Name ) ) ; } } } }
Adds assembly references required by the project item to its containing project.
Adds assembly references required by the project item to its containing project .
projectItem
ProjectItem
output
OutputFile