public void SetProjectTypeGuids(EnvDTE.Project proj)
        {
            string templatesDir = Path.Combine(GetTemplateBasePath(), "Items.Cache");

            //Helpers.EnsureGaxPackageRegistration("{14822709-B5A1-4724-98CA-57A101D1B079}", GetPackageGuid(), templatesDir, GetPackageCaption());
            Helpers.EnsureGaxPackageRegistration("{14822709-B5A1-4724-98CA-57A101D1B079}", "{14822709-B5A1-4724-98CA-57A101D1B079}", templatesDir, GetPackageCaption());

            string projectTypeGuids = "";
            object service          = null;

            Microsoft.VisualStudio.Shell.Interop.IVsSolution            solution            = null;
            Microsoft.VisualStudio.Shell.Interop.IVsHierarchy           hierarchy           = null;
            Microsoft.VisualStudio.Shell.Interop.IVsAggregatableProject aggregatableProject = null;
            int result = 0;

            service  = GetService(typeof(Microsoft.VisualStudio.Shell.Interop.IVsSolution));
            solution = (Microsoft.VisualStudio.Shell.Interop.IVsSolution)service;

            result = solution.GetProjectOfUniqueName(proj.UniqueName, out hierarchy);

            if (result == 0)
            {
                aggregatableProject = (Microsoft.VisualStudio.Shell.Interop.IVsAggregatableProject)hierarchy;
                result = aggregatableProject.GetAggregateProjectTypeGuids(out projectTypeGuids);

                //workflows
                if (!projectTypeGuids.ToUpper().Contains("{14822709-B5A1-4724-98CA-57A101D1B079}"))
                {
                    if (projectTypeGuids == "")
                    {
                        projectTypeGuids = "{14822709-B5A1-4724-98CA-57A101D1B079}";
                    }
                    else
                    {
                        projectTypeGuids = "{14822709-B5A1-4724-98CA-57A101D1B079}" + ";" + projectTypeGuids;
                    }
                }

                //csharp
                if (!projectTypeGuids.ToUpper().Contains("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"))
                {
                    if (projectTypeGuids != "")
                    {
                        projectTypeGuids += ";";
                    }
                    projectTypeGuids += "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";
                }

                aggregatableProject.SetAggregateProjectTypeGuids(projectTypeGuids);
            }
        }
Esempio n. 2
0
        internal static string GetProjectTypeGuids(EnvDTE.Project proj)
        {
            string projectTypeGuids = "";
            object service          = null;

            Microsoft.VisualStudio.Shell.Interop.IVsSolution            solution            = null;
            Microsoft.VisualStudio.Shell.Interop.IVsHierarchy           hierarchy           = null;
            Microsoft.VisualStudio.Shell.Interop.IVsAggregatableProject aggregatableProject = null;
            int result = 0;

            service  = GetService(proj.DTE, typeof(Microsoft.VisualStudio.Shell.Interop.IVsSolution));
            solution = (Microsoft.VisualStudio.Shell.Interop.IVsSolution)service;

            result = solution.GetProjectOfUniqueName(proj.UniqueName, out hierarchy);

            if (result == 0)
            {
                aggregatableProject = (Microsoft.VisualStudio.Shell.Interop.IVsAggregatableProject)hierarchy;
                result = aggregatableProject.GetAggregateProjectTypeGuids(out projectTypeGuids);
            }

            return(projectTypeGuids);
        }