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


C# Package.ProjectNode类代码示例

本文整理汇总了C#中Microsoft.VisualStudio.Package.ProjectNode的典型用法代码示例。如果您正苦于以下问题:C# ProjectNode类的具体用法?C# ProjectNode怎么用?C# ProjectNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProjectNode类属于Microsoft.VisualStudio.Package命名空间,在下文中一共展示了ProjectNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProjectElement

        /// <summary>
        /// Constructor to create a new MSBuild.BuildItem and add it to the project
        /// Only have internal constructors as the only one who should be creating
        /// such object is the project itself (see Project.CreateFileNode()).
        /// </summary>
        internal ProjectElement(ProjectNode project, string itemPath, string itemType)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            if (String.IsNullOrEmpty(itemPath))
            {
                throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "itemPath");
            }

            if (String.IsNullOrEmpty(itemType))
            {
                throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "itemType");
            }

            this.itemProject = project;

            // create and add the item to the project

            this.item = project.BuildProject.AddNewItem(itemType, Microsoft.Build.BuildEngine.Utilities.Escape(itemPath));
            this.itemProject.SetProjectFileDirty(true);
            this.RefreshProperties();
        }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:30,代码来源:projectelement.cs

示例2: AssemblyReferenceNode

        /// <summary>
        /// Constructor for the AssemblyReferenceNode
        /// </summary>
        public AssemblyReferenceNode(ProjectNode root, string assemblyPath)
            : base(root)
        {
            // Validate the input parameters.
            if (null == root)
            {
                throw new ArgumentNullException("root");
            }
            if (string.IsNullOrEmpty(assemblyPath))
            {
                throw new ArgumentNullException("assemblyPath");
            }

            this.InitializeFileChangeEvents();

            // The assemblyPath variable can be an actual path on disk or a generic assembly name.
            if (File.Exists(assemblyPath))
            {
                // The assemblyPath parameter is an actual file on disk; try to load it.
                this.assemblyName = System.Reflection.AssemblyName.GetAssemblyName(assemblyPath);
                this.assemblyPath = assemblyPath;

                // We register with listeningto chnages onteh path here. The rest of teh cases will call into resolving the assembly and registration is done there.
                this.fileChangeListener.ObserveItem(this.assemblyPath);
            }
            else
            {
                // The file does not exist on disk. This can be because the file / path is not
                // correct or because this is not a path, but an assembly name.
                // Try to resolve the reference as an assembly name.
                this.CreateFromAssemblyName(new System.Reflection.AssemblyName(assemblyPath));
            }
        }
开发者ID:einaregilsson,项目名称:Process-Language-Runtime,代码行数:36,代码来源:AssemblyReferenceNode.cs

示例3: ProjectElement

        /// <summary>
        /// Constructor to create a new MSBuild.ProjectItem and add it to the project
        /// Only have internal constructors as the only one who should be creating
        /// such object is the project itself (see Project.CreateFileNode()).
        /// </summary>
        internal ProjectElement(ProjectNode project, string itemPath, string itemType)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            if (String.IsNullOrEmpty(itemPath))
            {
                throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "itemPath");
            }

            if (String.IsNullOrEmpty(itemType))
            {
                throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "itemType");
            }

            this.itemProject = project;

            // create and add the item to the project
            DoAdd(itemType, itemPath);
            CheckAndTryToFixWildcards(itemType, itemPath);

            this.itemProject.SetProjectFileDirty(true);
            this.RefreshProperties();
        }
开发者ID:zooba,项目名称:wix3,代码行数:31,代码来源:projectelement.cs

示例4: ComReferenceNode

        /// <summary>
        /// Overloaded constructor for creating a ComReferenceNode from selector data
        /// </summary>
        /// <param name="root">The Project node</param>
        /// <param name="selectorData">The component selctor data.</param>
        public ComReferenceNode(ProjectNode root, VSCOMPONENTSELECTORDATA selectorData)
            : base(root)
        {
            if (root == null)
            {
                throw new ArgumentNullException("root");
            }
            if (selectorData.type == VSCOMPONENTTYPE.VSCOMPONENTTYPE_Project
                || selectorData.type == VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus)
            {
                throw new ArgumentException();
            }

            // Initialize private state
            this.typeName = selectorData.bstrTitle;
            this.typeGuid = selectorData.guidTypeLibrary;
            this.majorVersionNumber = selectorData.wTypeLibraryMajorVersion.ToString(CultureInfo.InvariantCulture);
            this.minorVersionNumber = selectorData.wTypeLibraryMinorVersion.ToString(CultureInfo.InvariantCulture);
            this.lcid = selectorData.lcidTypeLibrary.ToString(CultureInfo.InvariantCulture);

            // Check to see if the COM object actually exists.
            this.SetInstalledFilePath();
            // If the value cannot be set throw.
            if (String.IsNullOrEmpty(this.installedFilePath))
            {
                throw new ArgumentException();
            }
        }
开发者ID:einaregilsson,项目名称:Process-Language-Runtime,代码行数:33,代码来源:ComReferenceNode.cs

示例5: ProjectReferenceNode

        /// <summary>
        /// Constructor for the ReferenceNode. It is called when the project is reloaded, when the project element representing the refernce exists. 
        /// </summary>
        public ProjectReferenceNode(ProjectNode root, ProjectElement element)
            : base(root, element)
        {
            this.referencedProjectRelativePath = this.ItemNode.GetMetadata(ProjectFileConstants.Include);
            Debug.Assert(!String.IsNullOrEmpty(this.referencedProjectRelativePath), "Could not retrive referenced project path form project file");

            string guidString = this.ItemNode.GetMetadata(ProjectFileConstants.Project);

            // Continue even if project setttings cannot be read.
            try
            {
                this.referencedProjectGuid = new Guid(guidString);

                this.buildDependency = new BuildDependency(this.ProjectMgr, this.referencedProjectGuid);
                this.ProjectMgr.AddBuildDependency(this.buildDependency);
            }
            finally
            {
                Debug.Assert(this.referencedProjectGuid != Guid.Empty, "Could not retrive referenced project guidproject file");

                this.ReferencedProjectName = this.ItemNode.GetMetadata(ProjectFileConstants.Name);

                Debug.Assert(!String.IsNullOrEmpty(this.referencedProjectName), "Could not retrive referenced project name form project file");
            }

            Uri uri = new Uri(this.ProjectMgr.BaseURI.Uri, this.referencedProjectRelativePath);

            if (uri != null)
            {
                this.referencedProjectFullPath = Microsoft.VisualStudio.Shell.Url.Unescape(uri.LocalPath, true);
            }
        }
开发者ID:zooba,项目名称:wix3,代码行数:35,代码来源:ProjectReferenceNode.cs

示例6: AssemblyReferenceNode

 /// <summary>
 /// Constructor for the AssemblyReferenceNode
 /// </summary>
 public AssemblyReferenceNode(ProjectNode root, string assemblyPath)
     : base(root)
 {
     // Validate the input parameters.
     if (null == root)
     {
         throw new ArgumentNullException("root");
     }
     if (string.IsNullOrEmpty(assemblyPath))
     {
         throw new ArgumentNullException("assemblyPath");
     }
     // The assemblyPath variable can be an actual path on disk or a generic assembly name.
     if (File.Exists(assemblyPath))
     {
         // The assemblyPath parameter is an actual file on disk; try to load it.
         this.assemblyName = System.Reflection.AssemblyName.GetAssemblyName(assemblyPath);
         this.assemblyPath = assemblyPath;
     }
     else
     {
         // The file does not exist on disk. This can be because the file / path is not
         // correct or because this is not a path, but an assembly name.
         // Try to resolve the reference as an assembly name.
         CreateFromAssemblyName(new System.Reflection.AssemblyName(assemblyPath));
     }
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:30,代码来源:AssemblyReferenceNode.cs

示例7: Output

        /// <summary>
        /// Constructor for IVSOutput2 implementation
        /// </summary>
        /// <param name="projectManager">Project that produce this output</param>
        /// <param name="configuration">Configuration that produce this output</param>
        /// <param name="outputAssembly">MSBuild generated item corresponding to the output assembly (by default, these would be of type MainAssembly</param>
        public Output(ProjectNode projectManager, MSBuildExecution.ProjectItemInstance outputAssembly)
        {
            if (projectManager == null)
                throw new ArgumentNullException("projectManager");
            if (outputAssembly == null)
                throw new ArgumentNullException("outputAssembly");

            project = projectManager;
            output = outputAssembly;
        }
开发者ID:zooba,项目名称:wix3,代码行数:16,代码来源:output.cs

示例8: ProjectElement

        /// <summary>
        /// Constructor to create a new MSBuild.BuildItem and add it to the project
        /// Only have internal constructors as the only one who should be creating
        /// such object is the project itself (see Project.CreateFileNode()).
        /// </summary>
        internal ProjectElement(ProjectNode project, string itemPath, string itemType)
        {
            if (project == null)
                throw new ArgumentNullException("project", String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.AddToNullProjectError), itemPath));

            itemProject = project;

            // create and add the item to the project
            item = project.BuildProject.AddNewItem(itemType, itemPath);
            project.SetProjectFileDirty(true);
            this.RefreshProperties();
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:17,代码来源:ProjectElement.cs

示例9: Output

        /// <summary>
        /// Constructor for IVSOutput2 implementation
        /// </summary>
        /// <param name="projectManager">Project that produce this output</param>
        /// <param name="configuration">Configuration that produce this output</param>
        /// <param name="outputAssembly">MSBuild generated item corresponding to the output assembly (by default, these would be of type MainAssembly</param>
        public Output(ProjectNode projectManager, ProjectConfig configuration, ProjectElement outputAssembly)
        {
            if (projectManager == null)
                throw new ArgumentNullException("projectManager");
            if (configuration == null)
                throw new ArgumentNullException("configuration");
            if (outputAssembly == null)
                throw new ArgumentNullException("outputAssembly");

            project = projectManager;
            projectCfg = configuration;
            output = outputAssembly;
        }
开发者ID:Jeremiahf,项目名称:wix3,代码行数:19,代码来源:output.cs

示例10: OutputGroup

		/// <summary>
		/// Constructor for IVSOutputGroup2 implementation
		/// </summary>
		/// <param name="outputName">Name of the output group. See VS_OUTPUTGROUP_CNAME_Build in vsshell.idl for the list of standard values</param>
		/// <param name="msBuildTargetName">MSBuild target name</param>
		/// <param name="projectManager">Project that produce this output</param>
		/// <param name="configuration">Configuration that produce this output</param>
		public OutputGroup(string outputName, string msBuildTargetName, ProjectNode projectManager, ProjectConfig configuration)
		{
			if (outputName == null)
				throw new ArgumentNullException("outputName");
			if (msBuildTargetName == null)
				throw new ArgumentNullException("outputName");
			if (projectManager == null)
				throw new ArgumentNullException("projectManager");
			if (configuration == null)
				throw new ArgumentNullException("configuration");

			name = outputName;
			targetName = msBuildTargetName;
			project = projectManager;
			projectCfg = configuration;
		}
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:23,代码来源:outputgroup.cs

示例11: MultiverseInterfacePythonFileNode

 internal MultiverseInterfacePythonFileNode(ProjectNode root, ProjectElement e)
     : base(root, e)
 {
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:4,代码来源:MultiversePythonFileNode.cs

示例12: GetFileNamespace

        /// <summary>
        /// The goal here is to reduce the risk of name conflict between 2 classes
        /// added in different directories. This code does NOT garanty uniqueness.
        /// To garanty uniqueness, you should change this function to work with
        /// the language service to verify that the namespace+class generated does
        /// not conflict.
        /// </summary>
        /// <param name="fileFullPath">Full path to the new file</param>
        /// <returns>Namespace to use for the new file</returns>
        public string GetFileNamespace(string fileFullPath, ProjectNode node)
        {
            // Get base namespace from the project
            string namespce = node.GetProjectProperty("RootNamespace");
            if (String.IsNullOrEmpty(namespce))
                namespce = Path.GetFileNameWithoutExtension(fileFullPath); ;

            // If the item is added to a subfolder, the name space should reflect this.
            // This is done so that class names from 2 files with the same name but different
            // directories don't conflict.
            string relativePath = Path.GetDirectoryName(fileFullPath);
            string projectPath = Path.GetDirectoryName(node.GetMkDocument());
            // Our project system only support adding files that are sibling of the project file or that are in subdirectories.
            if (String.Compare(projectPath, 0, relativePath, 0, projectPath.Length, true, CultureInfo.CurrentCulture) == 0)
            {
                relativePath = relativePath.Substring(projectPath.Length);
            }
            else
            {
                Debug.Fail("Adding an item to the project that is NOT under the project folder.");
                // We are going to use the full file path for generating the namespace
            }

            // Get the list of parts
            int index = 0;
            string[] pathParts;
            pathParts = relativePath.Split(Path.DirectorySeparatorChar);

            // Use a string builder with default size being the expected size
            StringBuilder result = new StringBuilder(namespce, namespce.Length + relativePath.Length + 1);
            // For each path part
            while (index < pathParts.Length)
            {
                string part = pathParts[index];
                ++index;

                // This could happen if the path had leading/trailing slash, we want to ignore empty pieces
                if (String.IsNullOrEmpty(part))
                    continue;

                // If we reach here, we will be adding something, so add a namespace separator '.'
                result.Append('.');

                // Make sure it starts with a letter
                if (!char.IsLetter(part, 0))
                    result.Append('N');

                // Filter invalid namespace characters
                foreach (char c in part)
                {
                    if (char.IsLetterOrDigit(c))
                        result.Append(c);
                }
            }
            return result.ToString();
        }
开发者ID:einaregilsson,项目名称:Process-Language-Runtime,代码行数:65,代码来源:TokenProcessor.cs

示例13: CreateOutputGroup

 protected virtual OutputGroup CreateOutputGroup(ProjectNode project, KeyValuePair<string, string> group)
 {
     OutputGroup outputGroup = new OutputGroup(group.Key, group.Value, project, this);
     return outputGroup;
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:5,代码来源:ProjectConfig.cs

示例14: ProjectConfig

        public ProjectConfig(ProjectNode project, string configuration)
        {
            this.project = project;
            this.configName = configuration;

            // Because the project can be aggregated by a flavor, we need to make sure
            // we get the outer most implementation of that interface (hence: project --> IUnknown --> Interface)
            IntPtr projectUnknown = Marshal.GetIUnknownForObject(this.ProjectMgr);
            try
            {
                IVsProjectFlavorCfgProvider flavorCfgProvider = (IVsProjectFlavorCfgProvider)Marshal.GetTypedObjectForIUnknown(projectUnknown, typeof(IVsProjectFlavorCfgProvider));
                ErrorHandler.ThrowOnFailure(flavorCfgProvider.CreateProjectFlavorCfg(this, out flavoredCfg));
                if (flavoredCfg == null)
                    throw new COMException();
            }
            finally
            {
                if (projectUnknown != IntPtr.Zero)
                    Marshal.Release(projectUnknown);
            }
            // if the flavored object support XML fragment, initialize it
            IPersistXMLFragment persistXML = flavoredCfg as IPersistXMLFragment;
            if (null != persistXML)
            {
                this.project.LoadXmlFragment(persistXML, this.DisplayName);
            }
        }
开发者ID:Xtremrules,项目名称:dot42,代码行数:27,代码来源:ProjectConfig.cs

示例15: ProjectConfig

		public ProjectConfig(ProjectNode project, string configName, string platformName)
			: this(project, new ConfigCanonicalName(configName, platformName))
		{
		}
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:4,代码来源:projectconfig.cs


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