コード例 #1
0
ファイル: ProjectRootElement.cs プロジェクト: cdmihai/msbuild
 public static ProjectRootElement Create(string path, NewProjectFileOptions newProjectFileOptions)
 {
     return Create(path, ProjectCollection.GlobalProjectCollection, newProjectFileOptions);
 }
コード例 #2
0
ファイル: ProjectRootElement.cs プロジェクト: cdmihai/msbuild
        /// <summary>
        /// Initialize an in-memory, empty ProjectRootElement instance that can be saved later.
        /// Uses the specified project collection.
        /// </summary>
        public static ProjectRootElement Create(string path, ProjectCollection projectCollection, NewProjectFileOptions newProjectFileOptions)
        {
            ErrorUtilities.VerifyThrowArgumentLength(path, "path");
            ErrorUtilities.VerifyThrowArgumentNull(projectCollection, "projectCollection");

            ProjectRootElement projectRootElement = new ProjectRootElement(projectCollection.ProjectRootElementCache, newProjectFileOptions);
            projectRootElement.FullPath = path;

            return projectRootElement;
        }
コード例 #3
0
ファイル: ProjectRootElement.cs プロジェクト: cdmihai/msbuild
 public static ProjectRootElement Create(NewProjectFileOptions projectFileOptions)
 {
     return Create(ProjectCollection.GlobalProjectCollection, projectFileOptions);
 }
コード例 #4
0
ファイル: ProjectRootElement.cs プロジェクト: cdmihai/msbuild
        public static ProjectRootElement Create(ProjectCollection projectCollection, NewProjectFileOptions projectFileOptions)
        {
            ErrorUtilities.VerifyThrowArgumentNull(projectCollection, "projectCollection");

            return Create(projectCollection.ProjectRootElementCache, projectFileOptions);
        }
コード例 #5
0
ファイル: ProjectRootElement.cs プロジェクト: cdmihai/msbuild
 internal static ProjectRootElement Create(ProjectRootElementCache projectRootElementCache, NewProjectFileOptions projectFileOptions)
 {
     return new ProjectRootElement(projectRootElementCache, projectFileOptions);
 }
コード例 #6
0
ファイル: ProjectRootElement.cs プロジェクト: cdmihai/msbuild
        /// <summary>
        /// Initialize an in-memory, empty ProjectRootElement instance that can be saved later.
        /// Leaves the project dirty, indicating there are unsaved changes.
        /// </summary>
        private ProjectRootElement(ProjectRootElementCache projectRootElementCache, NewProjectFileOptions projectFileOptions)
        {
            ErrorUtilities.VerifyThrowArgumentNull(projectRootElementCache, "projectRootElementCache");

            _projectRootElementCache = projectRootElementCache;
            _directory = NativeMethodsShared.GetCurrentDirectory();
            IncrementVersion();

            XmlDocumentWithLocation document = new XmlDocumentWithLocation();

            XmlReaderSettings xrs = new XmlReaderSettings();
            xrs.DtdProcessing = DtdProcessing.Ignore;
            
            var emptyProjectFile = string.Format(EmptyProjectFileContent,
                (projectFileOptions & NewProjectFileOptions.IncludeXmlDeclaration) != 0 ? EmptyProjectFileXmlDeclaration : string.Empty,
                (projectFileOptions & NewProjectFileOptions.IncludeToolsVersion) != 0 ? EmptyProjectFileToolsVersion : string.Empty,
                (projectFileOptions & NewProjectFileOptions.IncludeXmlNamespace) != 0 ? EmptyProjectFileXmlNamespace : string.Empty);

            using (XmlReader xr = XmlReader.Create(new StringReader(emptyProjectFile), xrs))
            {
                document.Load(xr);
            }

            ProjectParser.Parse(document, this);
        }
コード例 #7
0
 /// <summary>
 /// Adds a .targets file to the buildTransitive directory.
 /// </summary>
 /// <param name="project">Receives the <see cref="ProjectCreator" /> of the created project file.</param>
 /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .targets file.</param>
 /// <returns>The current <see cref="PackageRepository" />.</returns>
 public PackageRepository BuildTransitiveTargets(out ProjectCreator project, NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions)
 {
     return(BuildTransitiveTargets(null, out project, projectFileOptions));
 }
コード例 #8
0
 /// <summary>
 /// Adds a .targets file to the buildTransitive directory.
 /// </summary>
 /// <param name="creator">An <see cref="Action{ProjectCreator}" /> to generate the .targets file.</param>
 /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .targets file.</param>
 /// <returns>The current <see cref="PackageRepository" />.</returns>
 public PackageRepository BuildTransitiveTargets(Action <ProjectCreator> creator, NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions)
 {
     return(BuildTransitiveTargets(creator, out _, projectFileOptions));
 }
コード例 #9
0
 /// <summary>
 /// Adds a .targets file to the buildTransitive directory.
 /// </summary>
 /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .targets file.</param>
 /// <returns>The current <see cref="PackageRepository" />.</returns>
 public PackageRepository BuildTransitiveTargets(NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions)
 {
     return(BuildTransitiveTargets(out _, projectFileOptions));
 }
コード例 #10
0
        /// <summary>
        /// Adds a .props file to the buildTransitive directory.
        /// </summary>
        /// <param name="creator">An <see cref="Action{ProjectCreator}" /> to generate the .props file.</param>
        /// <param name="project">Receives the <see cref="ProjectCreator" /> of the created project file.</param>
        /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .props file.</param>
        /// <returns>The current <see cref="PackageRepository" />.</returns>
        public PackageRepository BuildTransitiveProps(Action <ProjectCreator>?creator, out ProjectCreator project, NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions)
        {
            CreateBuildFile(".props", "buildTransitive", creator, projectFileOptions, out project);

            return(this);
        }
コード例 #11
0
 /// <summary>
 /// Adds a .props file to the buildMultitargeting directory.
 /// </summary>
 /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .props file.</param>
 /// <returns>The current <see cref="PackageRepository" />.</returns>
 public PackageRepository BuildMultiTargetingProps(NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions)
 {
     return(BuildMultiTargetingProps(null, projectFileOptions));
 }
コード例 #12
0
 /// <summary>
 /// Adds a .props file to the build directory.
 /// </summary>
 /// <param name="creator">An <see cref="Action{ProjectCreator}" /> to generate the .props file.</param>
 /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .props file.</param>
 /// <returns>The current <see cref="PackageRepository" />.</returns>
 public PackageRepository BuildProps(Action <ProjectCreator> creator, NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions)
 {
     return(BuildProps(creator, out ProjectCreator _, projectFileOptions));
 }
コード例 #13
0
 public static ProjectCreator TestingOnlyTemplate(this ProjectCreatorTemplates template, NewProjectFileOptions projectFileOptions, string param1 = null, string param2 = null)
 {
     return(ProjectCreator.Create(projectFileOptions: projectFileOptions)
            .Import(param1, param2));
 }