当前位置: 首页>>代码示例>>C#>>正文


C# ProjectRootElement.AddImport方法代码示例

本文整理汇总了C#中Microsoft.Build.Construction.ProjectRootElement.AddImport方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectRootElement.AddImport方法的具体用法?C# ProjectRootElement.AddImport怎么用?C# ProjectRootElement.AddImport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Build.Construction.ProjectRootElement的用法示例。


在下文中一共展示了ProjectRootElement.AddImport方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Process

        public override void Process(
            ProjectRootElement project,
            Dictionary<string, ProjectPropertyGroupElement> groups
        ) {
            ProjectPropertyGroupElement imports;
            if (!groups.TryGetValue("Imports", out imports)) {
                imports = project.AddPropertyGroup();
            }

            AddOrSetProperty(imports, "PtvsTargetsFile", @"$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets");
            project.AddImport("$(PtvsTargetsFile)").Condition = "Exists($(PtvsTargetsFile))";
            project.AddImport(@"$(MSBuildToolsPath)\Microsoft.Common.targets").Condition = "!Exists($(PtvsTargetsFile))";
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:13,代码来源:ProjectCustomizations.cs

示例2: CreateBuildProject

        void CreateBuildProject()
        {
            string projectPath = Path.Combine(buildDirectory, "content.contentproj");
            string outputPath = Path.Combine(buildDirectory, "bin");

            // Create the build project.
            projectRootElement = ProjectRootElement.Create(projectPath);

            // Include the standard targets file that defines how to build XNA Framework content.
            projectRootElement.AddImport(Application.StartupPath + "\\Exporters\\FBX\\XNA\\XNA Game Studio\\" +
                                         "v4.0\\Microsoft.Xna.GameStudio.ContentPipeline.targets");

            buildProject = new Project(projectRootElement);

            buildProject.SetProperty("XnaPlatform", "Windows");
            buildProject.SetProperty("XnaProfile", "Reach");
            buildProject.SetProperty("XnaFrameworkVersion", "v4.0");
            buildProject.SetProperty("Configuration", "Release");
            buildProject.SetProperty("OutputPath", outputPath);
            buildProject.SetProperty("ContentRootDirectory", ".");
            buildProject.SetProperty("ReferencePath", Application.StartupPath);

            // Register any custom importers or processors.
            foreach (string pipelineAssembly in pipelineAssemblies)
            {
                buildProject.AddItem("Reference", pipelineAssembly);
            }

            // Hook up our custom error logger.
            errorLogger = new ErrorLogger();

            buildParameters = new BuildParameters(ProjectCollection.GlobalProjectCollection)
                                  {Loggers = new ILogger[] {errorLogger}};
        }
开发者ID:nicolasmassouh,项目名称:Babylon.js,代码行数:34,代码来源:ContentBuilder.cs

示例3: AddImport

		static ProjectImportElement AddImport(
			ProjectRootElement projectRoot,
			string importedProjectFile,
			ProjectImportLocation importLocation)
		{
			if (importLocation == ProjectImportLocation.Top) {
				return AddImportAtTop(projectRoot, importedProjectFile);
			}
			return projectRoot.AddImport(importedProjectFile);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:10,代码来源:MSBuildBasedProjectExtensions.cs

示例4: CreateBuildProject

		/// <summary>
		/// Creates a temporary MSBuild content project in memory.
		/// </summary>
		private void CreateBuildProject()
		{
			string projectPath = Path.Combine(_buildDirectory, "content.contentproj");
			string outputPath = Path.Combine(_buildDirectory, "bin");

			// Create the build project.
			_projectRootElement = ProjectRootElement.Create(projectPath);

			// Include the standard targets file that defines how to build XNA Framework content.
			_projectRootElement.AddImport("$(MSBuildExtensionsPath)\\Microsoft\\XNA Game Studio\\"
				+ "v4.0\\Microsoft.Xna.GameStudio.ContentPipeline.targets");

			_buildProject = new Project(_projectRootElement);

			_buildProject.SetProperty("XnaPlatform", "Windows");

			IOptionsService optionsService = (IOptionsService) _serviceProvider.GetService(typeof (IOptionsService));
			_buildProject.SetProperty("XnaProfile", optionsService.GetContentPreviewOptions().Profile.ToString());

			_buildProject.SetProperty("XnaFrameworkVersion", XnaConstants.XnaFrameworkVersion);
			_buildProject.SetProperty("Configuration", "Release");
			_buildProject.SetProperty("OutputPath", outputPath);

			// Hook up our custom error logger.
			_errorLogger = new ErrorLogger();

			_buildParameters = new BuildParameters(ProjectCollection.GlobalProjectCollection);
			_buildParameters.Loggers = new ILogger[] { _errorLogger };
		}
开发者ID:modulexcite,项目名称:xbuilder,代码行数:32,代码来源:ContentBuilder.cs

示例5: UpgradeProject

        protected override void UpgradeProject(
            ref ProjectRootElement projectXml,
            ref ProjectRootElement userProjectXml,
            Action<__VSUL_ERRORLEVEL, string> log
        ) {
            Version version;

            // ToolsVersion less than 4.0 (or unspecified) is not supported, so
            // set it to 4.0.
            if (!Version.TryParse(projectXml.ToolsVersion, out version) ||
                version < new Version(4, 0)) {
                projectXml.ToolsVersion = "4.0";
                log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, SR.GetString(SR.UpgradedToolsVersion));
            }

            // Importing a targets file from 2.1 Beta
            var bottleImports = projectXml.Imports.Where(p => p.Project.Equals(Ptvs21BetaBottleTargets, StringComparison.OrdinalIgnoreCase)).ToList();
            var flaskImports = projectXml.Imports.Where(p => p.Project.Equals(Ptvs21BetaFlaskTargets, StringComparison.OrdinalIgnoreCase)).ToList();
            foreach (var import in bottleImports.Concat(flaskImports)) {
                import.Project = WebTargets;
            }

            if (bottleImports.Any()) {
                var globals = projectXml.PropertyGroups.FirstOrDefault() ?? projectXml.AddPropertyGroup();
                AddOrSetProperty(globals, "PythonDebugWebServerCommandArguments", "--debug $(CommandLineArguments)");
                AddOrSetProperty(globals, "PythonWsgiHandler", "{StartupModule}.wsgi_app()");
                log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, SR.GetString(SR.UpgradedBottleImports));
            }
            if (flaskImports.Any()) {
                var globals = projectXml.PropertyGroups.FirstOrDefault() ?? projectXml.AddPropertyGroup();
                AddOrSetProperty(globals, "PythonWsgiHandler", "{StartupModule}.wsgi_app");
                log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, SR.GetString(SR.UpgradedFlaskImports));
            }

            var commonPropsImports = projectXml.Imports.Where(p => p.Project.Equals(CommonProps, StringComparison.OrdinalIgnoreCase)).ToList();
            foreach (var p in commonPropsImports) {
                projectXml.RemoveChild(p);
                log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, SR.GetString(SR.UpgradedRemoveCommonProps));
            }
            
            if (projectXml.Imports.Count == 1 && projectXml.Imports.First().Project.Equals(CommonTargets, StringComparison.OrdinalIgnoreCase)) {
                projectXml.RemoveChild(projectXml.Imports.First());
                var group = projectXml.AddPropertyGroup();
                if (!projectXml.Properties.Any(p => p.Name == "VisualStudioVersion")) {
                    group.AddProperty("VisualStudioVersion", "10.0").Condition = "'$(VisualStudioVersion)' == ''";
                }
                group.AddProperty("PtvsTargetsFile", PtvsTargets);
                projectXml.AddImport("$(PtvsTargetsFile)").Condition = "Exists($(PtvsTargetsFile))";
                projectXml.AddImport(CommonTargets).Condition = "!Exists($(PtvsTargetsFile))";
                log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, SR.GetString(SR.UpgradedRemoveCommonTargets));
            }
        }
开发者ID:KaushikCh,项目名称:PTVS,代码行数:52,代码来源:PythonProjectFactory.cs

示例6: Process

 public override void Process(
     ProjectRootElement project,
     Dictionary<string, ProjectPropertyGroupElement> groups
 ) {
     project.AddImport(@"$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets");
 }
开发者ID:zooba,项目名称:PTVS,代码行数:6,代码来源:ProjectCustomizations.cs

示例7: ProcessImportsFrom22

        private static void ProcessImportsFrom22(ProjectRootElement projectXml, Action<__VSUL_ERRORLEVEL, string> log) {
            bool anyUpdated = false;
            var propValue = PtvsTargets;

            foreach (var p in projectXml.Properties.Where(IsPtvsTargetsFileProperty).ToArray()) {
                propValue = p.Value;
                p.Parent.RemoveChild(p);
                anyUpdated = true;
            }

            // Replace:
            // <Import Condition="Exists($(PtvsTargetsFile))" Project="$(PtvsTargetsFile)" />
            // <Import Condition="!Exists($(PtvsTargetsFile))" Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
            //
            // With:
            // <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
            foreach (var p in projectXml.Imports.Where(i => i.Condition.Contains("$(PtvsTargetsFile)") || i.Project.Equals("$(PtvsTargetsFile)")).ToArray()) {
                p.Parent.RemoveChild(p);
            }

            if (ContainsProjectTypeGuid(projectXml, UwpProjectGuid)) {
                projectXml.AddImport(UwpTargets);
            } else {
                projectXml.AddImport(PtvsTargets);
            }

            if (anyUpdated) {
                log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, Strings.UpgradedImportsFor30);
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:30,代码来源:PythonProjectFactory.cs

示例8: CreateBuildProject

        void CreateBuildProject()
        {
            string projectPath = Path.Combine(buildDirectory, "content.contentproj");
            string outputPath = Path.Combine(buildDirectory, "bin");

            projectRootElement = ProjectRootElement.Create(projectPath);
            //projectRootElement.AddImport(@"$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets");
            projectRootElement.AddImport("$(MSBuildExtensionsPath)\\Microsoft\\XNA Game Studio\\" +
                                         "v4.0\\Microsoft.Xna.GameStudio.ContentPipeline.targets");
            buildProject = new Project(projectRootElement);
            buildProject.SetProperty("XnaPlatform", "Windows");
            buildProject.SetProperty("XnaProfile", "Reach");
            //buildProject.SetProperty("Platform", "x86");
            buildProject.SetProperty("XnaFrameworkVersion", "v4.0");
            buildProject.SetProperty("TargetFrameworkVersion", "v4.0");
            buildProject.SetProperty("Configuration", "Release");
            buildProject.SetProperty("OutputPath", outputPath);

            foreach (string pipelineAssembly in pipelineAssemblies)
            {
                buildProject.AddItem("Reference", pipelineAssembly);
            }

            errorLogger = new ErrorLogger();
            buildParameters = new BuildParameters(ProjectCollection.GlobalProjectCollection);
            buildParameters.Loggers = new ILogger[] { errorLogger };
        }
开发者ID:rickbatka,项目名称:co-op-engine,代码行数:27,代码来源:ContentBuilder.cs

示例9: AddImports

 private void AddImports(ProjectRootElement project, IEnumerable<string> modulePaths)
 {
     foreach (ProjectImportElement import in modulePaths.Where(i => !String.IsNullOrWhiteSpace(i)).Select(modulePath => project.AddImport(Path.Combine(modulePath, ImportRelativePath))))
     {
         import.Condition = $"Exists('{import.Project}')";
     }
 }
开发者ID:CommonBuildToolset,项目名称:CBT.Core,代码行数:7,代码来源:ModulePropertyGenerator.cs

示例10: CreateBuildProject

        /// <summary>
        /// Creates a temporary MSBuild content project in memory.
        /// </summary>
        void CreateBuildProject()
        {
            string projectPath = Path.Combine(buildDirectory, "content.contentproj");
            string outputPath = Path.Combine(buildDirectory, "bin");

            // Create the build project.
            projectRootElement = ProjectRootElement.Create(projectPath);

            // Include the standard targets file that defines how to build XNA Framework content.
            projectRootElement.AddImport("$(MSBuildExtensionsPath)\\Microsoft\\XNA Game Studio\\" +
                                         "v4.0\\Microsoft.Xna.GameStudio.ContentPipeline.targets");

            buildProject = new Project(projectRootElement);

            ProjectItemGroupElement teste = projectRootElement.AddItemGroup();

            teste.AddItem("ProjectReference", @"C:\Users\Renann\Desktop\StrategyGame\StrategyGameLibrary\StrategyGameLibrary.csproj");

            buildProject.SetProperty("XnaPlatform", "Windows");
            buildProject.SetProperty("XnaProfile", "Reach");
            buildProject.SetProperty("XnaFrameworkVersion", "v4.0");
            buildProject.SetProperty("Configuration", "Release");
            buildProject.SetProperty("OutputPath", outputPath);

            // Register any custom importers or processors.
            foreach (string pipelineAssembly in pipelineAssemblies)
            {
                buildProject.AddItem("Reference", pipelineAssembly);
            }

            // Hook up our custom error logger.
            errorLogger = new ErrorLogger();

            buildParameters = new BuildParameters(ProjectCollection.GlobalProjectCollection);
            buildParameters.Loggers = new ILogger[] { errorLogger };
        }
开发者ID:renannprado,项目名称:xnastrategygame,代码行数:39,代码来源:ContentBuilder.cs

示例11: ProcessImportsFrom21b

        private static void ProcessImportsFrom21b(ProjectRootElement projectXml, Action<__VSUL_ERRORLEVEL, string> log) {
            var bottleImports = projectXml.Imports.Where(p => p.Project.Equals(Ptvs21BetaBottleTargets, StringComparison.OrdinalIgnoreCase)).ToList();
            var flaskImports = projectXml.Imports.Where(p => p.Project.Equals(Ptvs21BetaFlaskTargets, StringComparison.OrdinalIgnoreCase)).ToList();
            foreach (var import in bottleImports.Concat(flaskImports)) {
                import.Project = WebTargets;
            }

            if (bottleImports.Any()) {
                var globals = projectXml.PropertyGroups.FirstOrDefault() ?? projectXml.AddPropertyGroup();
                AddOrSetProperty(globals, "PythonDebugWebServerCommandArguments", "--debug $(CommandLineArguments)");
                AddOrSetProperty(globals, "PythonWsgiHandler", "{StartupModule}.wsgi_app()");
                log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, Strings.UpgradedBottleImports);
            }
            if (flaskImports.Any()) {
                var globals = projectXml.PropertyGroups.FirstOrDefault() ?? projectXml.AddPropertyGroup();
                AddOrSetProperty(globals, "PythonWsgiHandler", "{StartupModule}.wsgi_app");
                log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, Strings.UpgradedFlaskImports);
            }

            var commonPropsImports = projectXml.Imports.Where(p => p.Project.Equals(CommonProps, StringComparison.OrdinalIgnoreCase)).ToList();
            foreach (var p in commonPropsImports) {
                projectXml.RemoveChild(p);
                log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, Strings.UpgradedRemoveCommonProps);
            }

            if (projectXml.Imports.Count == 1 && projectXml.Imports.First().Project.Equals(CommonTargets, StringComparison.OrdinalIgnoreCase)) {
                projectXml.RemoveChild(projectXml.Imports.First());
                projectXml.AddImport(PtvsTargets);
                log(__VSUL_ERRORLEVEL.VSUL_INFORMATIONAL, Strings.UpgradedRemoveCommonTargets);
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:31,代码来源:PythonProjectFactory.cs

示例12: CreateBuildProject

        /// <summary>
        /// Creates a temporary MSBuild content project in memory.
        /// </summary>
        void CreateBuildProject()
        {
            string projectPath = Path.Combine(buildDirectory, "content.contentproj");
            string outputPath = Path.Combine(buildDirectory, "bin");

            // Create the build project.
            projectRootElement = ProjectRootElement.Create(projectPath);

            // Include the standard targets file that defines how to build XNA Framework content.
            projectRootElement.AddImport("$(MSBuildExtensionsPath)\\Microsoft\\XNA Game Studio\\" +
                                         "v4.0\\Microsoft.Xna.GameStudio.ContentPipeline.targets");

            buildProject = new Project(projectRootElement);

            buildProject.SetProperty("XnaPlatform", "Windows");
            buildProject.SetProperty("XnaProfile", "Reach");
            buildProject.SetProperty("XnaFrameworkVersion", "v4.0");
            buildProject.SetProperty("Configuration", "Release");
            buildProject.SetProperty("OutputPath", outputPath);

            // Register any custom importers or processors.
            foreach (string pipelineAssembly in pipelineAssemblies)
            {
                buildProject.AddItem("Reference", pipelineAssembly);
            }

            buildParameters = new BuildParameters(ProjectCollection.GlobalProjectCollection);
        }
开发者ID:hilts-vaughan,项目名称:inspire,代码行数:31,代码来源:ContentBuilder.cs


注:本文中的Microsoft.Build.Construction.ProjectRootElement.AddImport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。