Example #1
0
        public PackageInstaller(SetupConfiguration configuration, IProgress progress)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");
            if (progress == null)
                throw new ArgumentNullException("progress");

            _configuration = configuration;
            _progress = progress;
        }
Example #2
0
 static ThemeCategoryDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("ThemeCategory");
 }
Example #3
0
 static ReleasePublishCategoryDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("ReleasePublishCategory");
 }
Example #4
0
 static ApplicationEntityParentalHierarchyDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("ApplicationEntityParentalHierarchy");
 }
Example #5
0
 static SystemDevNumbersDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("SystemDevNumbers");
 }
Example #6
0
 static ModuleDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("Module");
 }
Example #7
0
 static UseCaseXUseCaseStepDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("UseCaseXUseCaseStep");
 }
Example #8
0
 static PortfolioXCustodianAccountDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("PortfolioXCustodianAccount");
 }
Example #9
0
 static UseCasePackageXUseCaseDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("UseCasePackageXUseCase");
 }
        private void StartWithChromeV2Debugger(string file, string nodePath, bool startBrowser)
        {
            var serviceProvider = _project.Site;

            var setupConfiguration = new SetupConfiguration();

            var setupInstance = setupConfiguration.GetInstanceForCurrentProcess();

            var visualStudioInstallationInstanceID = setupInstance.GetInstanceId();

            // The Node2Adapter depends on features only in Node v6+, so the old v5.4 version of node will not suffice for this scenario
            // This node.exe will be the one used by the node2 debug adapter, not the one used to host the user code.
            var pathToNodeExe = Path.Combine(setupInstance.GetInstallationPath(), "JavaScript\\Node.JS\\v6.4.0_x86\\Node.exe");

            // We check the registry to see if any parameters for the node.exe invocation have been specified (like "--inspect"), and append them if we find them.
            string nodeParams = CheckForRegistrySpecifiedNodeParams();

            if (!string.IsNullOrEmpty(nodeParams))
            {
                pathToNodeExe = pathToNodeExe + " " + nodeParams;
            }

            var pathToNode2DebugAdapterRuntime = Environment.ExpandEnvironmentVariables(@"""%ALLUSERSPROFILE%\" +
                                                                                        $@"Microsoft\VisualStudio\NodeAdapter\{visualStudioInstallationInstanceID}\extension\out\src\nodeDebug.js""");

            string trimmedPathToNode2DebugAdapter = pathToNode2DebugAdapterRuntime.Replace("\"", "");

            if (!File.Exists(trimmedPathToNode2DebugAdapter))
            {
                pathToNode2DebugAdapterRuntime = Environment.ExpandEnvironmentVariables(@"""%ALLUSERSPROFILE%\" +
                                                                                        $@"Microsoft\VisualStudio\NodeAdapter\{visualStudioInstallationInstanceID}\out\src\nodeDebug.js""");
            }

            // Here we need to massage the env variables into the format expected by node and vs code
            var webBrowserUrl = GetFullUrl();
            var envVars       = GetEnvironmentVariables(webBrowserUrl);

            var cwd           = _project.GetWorkingDirectory(); // Current working directory
            var configuration = new JObject(
                new JProperty("name", "Debug Node.js program from Visual Studio"),
                new JProperty("type", "node2"),
                new JProperty("request", "launch"),
                new JProperty("program", file),
                new JProperty("runtimeExecutable", nodePath),
                new JProperty("cwd", cwd),
                new JProperty("console", "externalTerminal"),
                new JProperty("env", JObject.FromObject(envVars)),
                new JProperty("trace", CheckEnableDiagnosticLoggingOption()),
                new JProperty("sourceMaps", true),
                new JProperty("stopOnEntry", true),
                new JProperty("$adapter", pathToNodeExe),
                new JProperty("$adapterArgs", pathToNode2DebugAdapterRuntime));

            var jsonContent = configuration.ToString();

            var debugTargets = new[] {
                new VsDebugTargetInfo4()
                {
                    dlo = (uint)DEBUG_LAUNCH_OPERATION.DLO_CreateProcess,
                    guidLaunchDebugEngine = WebKitDebuggerV2Guid,
                    bstrExe     = file,
                    bstrOptions = jsonContent
                }
            };

            var processInfo = new VsDebugTargetProcessInfo[debugTargets.Length];

            var debugger = serviceProvider.GetService(typeof(SVsShellDebugger)) as IVsDebugger4;

            debugger.LaunchDebugTargets4(1, debugTargets, processInfo);

            // Launch browser
            if (startBrowser)
            {
                Uri uri = null;
                if (!String.IsNullOrWhiteSpace(webBrowserUrl))
                {
                    uri = new Uri(webBrowserUrl);
                }

                if (uri != null)
                {
                    OnPortOpenedHandler.CreateHandler(
                        uri.Port,
                        shortCircuitPredicate: () => false,
                        action: () =>
                    {
                        VsShellUtilities.OpenBrowser(webBrowserUrl, (uint)__VSOSPFLAGS.OSP_LaunchNewBrowser);
                    }
                        );
                }
            }
        }
Example #11
0
 static TypeOfIssueDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("TypeOfIssue");
 }
Example #12
0
 static ConnectionStringDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("ConnectionString");
 }
Example #13
0
        private static List <IDEInfo> BuildIDEInfos()
        {
            var ideInfos = new List <IDEInfo>();

            // Visual Studio 14.0 (2015)
            var localMachine32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);

            using (var subkey = localMachine32.OpenSubKey($@"SOFTWARE\Microsoft\{"VisualStudio"}\{"14.0"}"))
            {
                var path = (string)subkey?.GetValue("InstallDir");

                var vs14InstallPath = (path != null) ? Path.Combine(path, "devenv.exe") : null;
                if (vs14InstallPath != null && File.Exists(vs14InstallPath))
                {
                    var vsixInstallerPath = Path.Combine(path, "VSIXInstaller.exe");
                    if (!File.Exists(vsixInstallerPath))
                    {
                        vsixInstallerPath = null;
                    }

                    ideInfos.Add(new IDEInfo("14.0", "Visual Studio 2015", path)
                    {
                        DevenvPath = vs14InstallPath, VsixInstallerVersion = VSIXInstallerVersion.VS2015, VsixInstallerPath = vsixInstallerPath
                    });
                }
            }

            // Visual Studio 15.0 (2017) and later
            try
            {
                var configuration = new SetupConfiguration();

                var instances = configuration.EnumAllInstances();
                instances.Reset();
                var inst = new ISetupInstance[1];

                while (true)
                {
                    instances.Next(1, inst, out int pceltFetched);
                    if (pceltFetched <= 0)
                    {
                        break;
                    }

                    try
                    {
                        var inst2 = inst[0] as ISetupInstance2;
                        if (inst2 == null)
                        {
                            continue;
                        }

                        var installationPath = inst2.GetInstallationPath();
                        var buildToolsPath   = Path.Combine(installationPath, "MSBuild", "15.0", "Bin");
                        if (!Directory.Exists(buildToolsPath))
                        {
                            buildToolsPath = null;
                        }
                        var idePath    = Path.Combine(installationPath, "Common7", "IDE");
                        var devenvPath = Path.Combine(idePath, "devenv.exe");
                        if (!File.Exists(devenvPath))
                        {
                            devenvPath = null;
                        }
                        var vsixInstallerPath = Path.Combine(idePath, "VSIXInstaller.exe");
                        if (!File.Exists(vsixInstallerPath))
                        {
                            vsixInstallerPath = null;
                        }

                        var displayName = inst2.GetDisplayName();
                        // Try to append nickname (if any)
                        try
                        {
                            var nickname = inst2.GetProperties().GetValue("nickname") as string;
                            if (!string.IsNullOrEmpty(nickname))
                            {
                                displayName = $"{displayName} ({nickname})";
                            }
                        }
                        catch (COMException)
                        {
                        }

                        try
                        {
                            var minimumRequiredState = InstanceState.Local | InstanceState.Registered;
                            if ((inst2.GetState() & minimumRequiredState) != minimumRequiredState)
                            {
                                continue;
                            }
                        }
                        catch (COMException)
                        {
                            continue;
                        }

                        var ideInfo = new IDEInfo(inst2.GetInstallationVersion(), displayName, installationPath, inst2.IsComplete())
                        {
                            BuildToolsPath       = buildToolsPath,
                            DevenvPath           = devenvPath,
                            VsixInstallerVersion = VSIXInstallerVersion.VS2017AndFutureVersions,
                            VsixInstallerPath    = vsixInstallerPath
                        };

                        // Fill packages
                        foreach (var package in inst2.GetPackages())
                        {
                            ideInfo.PackageVersions[package.GetId()] = package.GetVersion();
                        }

                        ideInfos.Add(ideInfo);
                    }
                    catch (Exception)
                    {
                        // Something might have happened inside Visual Studio Setup code (had FileNotFoundException in GetInstallationPath() for example)
                        // Let's ignore this instance
                    }
                }
            }
            catch (COMException comException) when(comException.HResult == REGDB_E_CLASSNOTREG)
            {
                // COM is not registered. Assuming no instances are installed.
            }
            return(ideInfos);
        }
Example #14
0
 static AuditHistoryDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("AuditHistory");
 }
Example #15
0
        public static DataTable EntityTestData(RequestProfile requestProfile, int applicationId, string appName, string entityName)
        {
            // add columns as entityname, application id, entity id, test data count, audit data count
            DataTable result = new DataTable();

            result.Columns.Add("Entity Id");
            result.Columns.Add("Application Id");
            result.Columns.Add("Entity Name");
            result.Columns.Add("Test Data Count");
            result.Columns.Add("Audit Data Count");

            DataRow   tempRow = null;
            DataTable dtEntities;

            //if (applicationId != -1)
            dtEntities = GetList(requestProfile);
            //else
            //{
            //RequestProfile rp=new RequestProfile();
            //rp.ApplicationId = applicationId;
            //dtEntities = GetList(null);
            //}

            DataTable dtSetupConfiguration = null;

            // i think u'll have to check this if it is using some application id or not for fetching data,, if not plz modify it
            if (applicationId != -1)
            {
                dtSetupConfiguration = SetupConfiguration.GetList(-1, appName);
            }
            else
            {
                dtSetupConfiguration = SetupConfiguration.GetList(-1, null);
            }

            if (entityName != "All")
            {
                var entityId = 0;

                var tmpRows = dtEntities.Select("EntityName = '" + entityName + "'");

                if (tmpRows.Length > 0)
                {
                    entityId = Convert.ToInt32(tmpRows[0]["SystemEntityTypeId"]);
                }

                // Execute step2

                var count = 0;

                var SQLKey = ".SQL.GetEntityTestDataCount.sql";

                // Get SQL Template and replace parameters
                var assembly       = Assembly.GetExecutingAssembly();
                var scriptTemplate = GetResourceText(assembly, SQLKey);

                var replacementFieldSet = new Dictionary <string, string>();
                var replacementOtherSet = new Dictionary <string, string>();

                replacementOtherSet.Add("@EntityName@", entityName);
                if (applicationId != -1)
                {
                    replacementOtherSet.Add("@ApplicationId@", applicationId.ToString());
                }
                else
                {
                    replacementOtherSet.Add("@ApplicationId@", requestProfile.ApplicationId.ToString());
                }
                var sql = GetSQL(replacementFieldSet, replacementOtherSet, scriptTemplate, assembly.GetName().Name + SQLKey);

                var id = DBDML.RunScalarSQL("EntityName.GetCount", sql, DataStoreKey);
                count = Convert.ToInt32(id);

                //execute step 3

                var noOfAudit = 0;

                var SQLAuditCount = ".SQL.GetEntityDetails.sql";

                var scriptAuditTemplate = GetResourceText(assembly, SQLAuditCount);

                var replacementFieldSetAudit = new Dictionary <string, string>();
                var replacementOtherSetAudit = new Dictionary <string, string>();

                replacementOtherSetAudit.Add("@EntityName@", entityName);
                replacementOtherSetAudit.Add("@SystemEntityTypeId@", entityId.ToString());

                var sqlAudit = GetSQL(replacementFieldSetAudit, replacementOtherSetAudit, scriptAuditTemplate, assembly.GetName().Name + SQLAuditCount);

                var noOfAuditRecords = DBDML.RunScalarSQL("EntityName.GetAuditCount", sqlAudit, DataStoreKey);
                noOfAudit = Convert.ToInt32(noOfAuditRecords);
                // create a row in result table
                tempRow = result.NewRow();
                // add the data in row
                tempRow["Entity Id"] = entityId.ToString();
                if (applicationId != -1)
                {
                    tempRow["Application Id"] = applicationId.ToString();
                }
                else
                {
                    tempRow["Application Id"] = requestProfile.ApplicationId;
                }
                //tempRow["Application Id"] = appId;
                tempRow["Entity Name"]      = entityName;
                tempRow["Test Data Count"]  = count;
                tempRow["Audit Data Count"] = noOfAudit;

                result.Rows.Add(tempRow);
            }
            else
            {
                foreach (DataRow row in dtSetupConfiguration.Rows)
                {
                    entityName = row["EntityName"].ToString();
                    var appId = row["ConnectionKeyName"].ToString();

                    var entityId = 0;

                    var tmpRows = dtEntities.Select("EntityName = '" + entityName + "'");

                    if (tmpRows.Length > 0)
                    {
                        entityId = Convert.ToInt32(tmpRows[0]["SystemEntityTypeId"]);
                    }

                    // Execute step2

                    var count = 0;

                    var SQLKey = ".SQL.GetEntityTestDataCount.sql";

                    // Get SQL Template and replace parameters
                    var assembly       = Assembly.GetExecutingAssembly();
                    var scriptTemplate = GetResourceText(assembly, SQLKey);

                    var replacementFieldSet = new Dictionary <string, string>();
                    var replacementOtherSet = new Dictionary <string, string>();

                    replacementOtherSet.Add("@EntityName@", entityName);

                    if (applicationId != -1)
                    {
                        replacementOtherSet.Add("@ApplicationId@", applicationId.ToString());
                    }
                    else
                    {
                        replacementOtherSet.Add("@ApplicationId@", requestProfile.ApplicationId.ToString());
                    }

                    var sql = GetSQL(replacementFieldSet, replacementOtherSet, scriptTemplate, assembly.GetName().Name + SQLKey);

                    var id = DBDML.RunScalarSQL("EntityName.GetCount", sql, DataStoreKey);
                    count = Convert.ToInt32(id);

                    //execute step 3

                    var noOfAudit = 0;

                    var SQLAuditCount = ".SQL.GetEntityDetails.sql";

                    var scriptAuditTemplate = GetResourceText(assembly, SQLAuditCount);

                    var replacementFieldSetAudit = new Dictionary <string, string>();
                    var replacementOtherSetAudit = new Dictionary <string, string>();

                    replacementOtherSetAudit.Add("@EntityName@", entityName);
                    replacementOtherSetAudit.Add("@SystemEntityTypeId@", entityId.ToString());

                    var sqlAudit = GetSQL(replacementFieldSetAudit, replacementOtherSetAudit, scriptAuditTemplate, assembly.GetName().Name + SQLAuditCount);

                    var noOfAuditRecords = DBDML.RunScalarSQL("EntityName.GetAuditCount", sqlAudit, DataStoreKey);
                    noOfAudit = Convert.ToInt32(noOfAuditRecords);
                    // create a row in result table
                    tempRow = result.NewRow();
                    // add the data in row
                    tempRow["Entity Id"] = entityId.ToString();
                    if (applicationId != -1)
                    {
                        tempRow["Application Id"] = applicationId.ToString();
                    }
                    else
                    {
                        tempRow["Application Id"] = appId;
                    }
                    tempRow["Entity Name"]      = entityName;
                    tempRow["Test Data Count"]  = count;
                    tempRow["Audit Data Count"] = noOfAudit;

                    result.Rows.Add(tempRow);
                }
            }

            return(result);
        }
Example #16
0
        public void TestLinkProcessorArchitectureFilter()
        {
            // configurations
            SetupConfiguration nofilterConfiguration = new SetupConfiguration();
            SetupConfiguration x86Configuration      = new SetupConfiguration();

            x86Configuration.processor_architecture_filter = "x86";
            SetupConfiguration x64Configuration = new SetupConfiguration();

            x64Configuration.processor_architecture_filter = "x64";
            SetupConfiguration mipsConfiguration = new SetupConfiguration();

            mipsConfiguration.processor_architecture_filter = "mips";
            // components
            ComponentCmd nofilterComponent = new ComponentCmd();
            ComponentCmd x86Component      = new ComponentCmd();

            x86Component.processor_architecture_filter = "x86";
            ComponentCmd x64Component = new ComponentCmd();

            x64Component.processor_architecture_filter = "x64";
            ComponentCmd mipsComponent = new ComponentCmd();

            mipsComponent.processor_architecture_filter = "mips";
            // make a tree
            nofilterConfiguration.Children.Add(nofilterComponent);
            nofilterConfiguration.Children.Add(x86Component);
            nofilterConfiguration.Children.Add(x64Component);
            nofilterConfiguration.Children.Add(mipsComponent);
            x86Configuration.Children.Add(nofilterComponent);
            x86Configuration.Children.Add(x86Component);
            x86Configuration.Children.Add(x64Component);
            x86Configuration.Children.Add(mipsComponent);
            x64Configuration.Children.Add(nofilterComponent);
            x64Configuration.Children.Add(x86Component);
            x64Configuration.Children.Add(x64Component);
            x64Configuration.Children.Add(mipsComponent);
            mipsConfiguration.Children.Add(nofilterComponent);
            mipsConfiguration.Children.Add(x86Component);
            mipsConfiguration.Children.Add(x64Component);
            mipsConfiguration.Children.Add(mipsComponent);
            // configfile
            ConfigFile configFile = new ConfigFile();

            configFile.Children.Add(nofilterConfiguration);
            configFile.Children.Add(x86Configuration);
            configFile.Children.Add(x64Configuration);
            configFile.Children.Add(mipsConfiguration);
            // write a configuration
            InstallerLinkerArguments args = new InstallerLinkerArguments();

            args.processorArchitecture = "x86,alpha";
            args.config = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");
            args.output = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".exe");
            Console.WriteLine("Writing '{0}'", args.config);
            try
            {
                configFile.SaveAs(args.config);
                Console.WriteLine("Linking '{0}'", args.output);
                args.template = dotNetInstallerExeUtils.Executable;
                InstallerLib.InstallerLinker.CreateInstaller(args);
                // check that the linker generated output
                Assert.IsTrue(File.Exists(args.output));
                Assert.IsTrue(new FileInfo(args.output).Length > 0);
                using (ResourceInfo ri = new ResourceInfo())
                {
                    ri.Load(args.output);
                    List <Resource> custom = ri.Resources[new ResourceId("CUSTOM")];
                    Assert.AreEqual(custom[1].Name, new ResourceId("RES_CONFIGURATION"));
                    byte[] data = custom[1].WriteAndGetBytes();
                    // skip BOM
                    String      config = Encoding.UTF8.GetString(data, 3, data.Length - 3);
                    XmlDocument xmldoc = new XmlDocument();
                    xmldoc.LoadXml(config);
                    ConfigFile filteredConfig = new ConfigFile();
                    filteredConfig.LoadXml(xmldoc);
                    Assert.AreEqual(2, filteredConfig.ConfigurationCount);
                    Assert.AreEqual(4, filteredConfig.ComponentCount);
                }
            }
            finally
            {
                if (File.Exists(args.config))
                {
                    File.Delete(args.config);
                }
                if (File.Exists(args.output))
                {
                    File.Delete(args.output);
                }
            }
        }
Example #17
0
        /// <summary>
        /// Returns all system includes of the installed VS 2017 instance.
        /// </summary>
        /// <param name="vsDir">Path to the visual studio installation (for identifying the correct instance)</param>
        /// <returns>The system includes</returns>
        private static List <string> GetSystemIncludesVS2017(string vsDir)
        {
            List <string> includes = new List <string>();
            //They includes are in a different folder
            const int REGDB_E_CLASSNOTREG = unchecked ((int)0x80040154);

            try
            {
                var query  = new SetupConfiguration();
                var query2 = (ISetupConfiguration2)query;
                var e      = query2.EnumAllInstances();

                int fetched;
                var instances            = new ISetupInstance[1];
                var regexWinSDK10Version = new Regex(@"Windows10SDK\.(\d+)\.?");
                do
                {
                    e.Next(1, instances, out fetched);
                    if (fetched > 0)
                    {
                        var instance = (ISetupInstance2)instances[0];
                        if (instance.GetInstallationPath() != vsDir)
                        {
                            continue;
                        }
                        var packages = instance.GetPackages();
                        var vc_tools = from package in packages
                                       where package.GetId().Contains("Microsoft.VisualStudio.Component.VC.Tools")
                                       orderby package.GetId()
                                       select package;

                        if (vc_tools.Any())
                        {                         // Tools found, get path
                            var path            = instance.GetInstallationPath();
                            var versionFilePath = path + @"\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt";
                            var version         = System.IO.File.ReadLines(versionFilePath).ElementAt(0).Trim();
                            includes.Add(path + @"\VC\Tools\MSVC\" + version + @"\include");
                            includes.Add(path + @"\VC\Tools\MSVC\" + version + @"\atlmfc\include");
                        }
                        var sdks = from package in packages
                                   where package.GetId().Contains("Windows10SDK") || package.GetId().Contains("Windows81SDK") || package.GetId().Contains("Win10SDK_10")
                                   select package;
                        var win10sdks = from sdk in sdks
                                        where sdk.GetId().Contains("Windows10SDK")
                                        select sdk;
                        var win8sdks = from sdk in sdks
                                       where sdk.GetId().Contains("Windows81SDK")
                                       select sdk;
                        if (win10sdks.Any())
                        {
                            var    sdk          = win10sdks.Last();
                            var    matchVersion = regexWinSDK10Version.Match(sdk.GetId());
                            string path;
                            if (matchVersion.Success)
                            {
                                Environment.SpecialFolder specialFolder = Environment.Is64BitOperatingSystem ?
                                                                          Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles;
                                var programFiles = Environment.GetFolderPath(specialFolder);
                                path = Path.Combine(programFiles, "Windows Kits", "10", "include",
                                                    $"10.0.{matchVersion.Groups[1].Value}.0");
                            }
                            else
                            {
                                path = "<invalid>";
                            }
                            var shared = Path.Combine(path, "shared");
                            var um     = Path.Combine(path, "um");
                            var winrt  = Path.Combine(path, "winrt");
                            var ucrt   = Path.Combine(path, "ucrt");
                            Console.WriteLine(path);
                            if (Directory.Exists(shared) &&
                                Directory.Exists(um) &&
                                Directory.Exists(winrt) &&
                                Directory.Exists(ucrt))
                            {
                                includes.Add(shared);
                                includes.Add(um);
                                includes.Add(winrt);
                                includes.Add(ucrt);
                            }
                        }
                        else if (win8sdks.Any())
                        {
                            includes.Add(@"C:\Program Files (x86)\Windows Kits\8.1\include\shared");
                            includes.Add(@"C:\Program Files (x86)\Windows Kits\8.1\include\um");
                            includes.Add(@"C:\Program Files (x86)\Windows Kits\8.1\include\winrt");
                        }

                        return(includes);                        //We've collected all information.
                    }
                }while (fetched > 0);
            }
            // a COM exception means the VS 2017 COM API (therefore VS itself) is not installed, ignore
            catch (COMException ex) when(ex.HResult == REGDB_E_CLASSNOTREG)
            {
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine($"Error 0x{ex.HResult:x8}: {ex.Message}");
            }
            return(includes);
        }
Example #18
0
 static ProjectXNeedDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("ProjectXNeed");
 }
Example #19
0
 static AuditLogDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("AuditLog");
 }
Example #20
0
 static TimeZoneDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("TimeZone");
 }
Example #21
0
 static SystemForeignRelationshipTypeDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("SystemForeignRelationshipType");
 }
Example #22
0
 static OrderStatusGroupDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("OrderStatusGroup");
 }
Example #23
0
 static HolidayDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("Holiday");
 }
Example #24
0
 static NotificationRegistrarDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("NotificationRegistrar");
 }
Example #25
0
 static StoredProcedureLogRawDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("StoredProcedureLogRaw");
 }
Example #26
0
        private static List <IDEInfo> BuildIDEInfos()
        {
            var ideInfos = new List <IDEInfo>();

            // Visual Studio 15.0 (2017) and later
            try
            {
                var configuration = new SetupConfiguration();

                var instances = configuration.EnumAllInstances();
                instances.Reset();
                var inst = new ISetupInstance[1];

                while (true)
                {
                    instances.Next(1, inst, out int pceltFetched);
                    if (pceltFetched <= 0)
                    {
                        break;
                    }

                    try
                    {
                        var inst2 = inst[0] as ISetupInstance2;
                        if (inst2 == null)
                        {
                            continue;
                        }

                        // Only deal with VS2019+
                        if (!Version.TryParse(inst2.GetInstallationVersion(), out var version) ||
                            version.Major < 16)
                        {
                            continue;
                        }

                        var installationPath = inst2.GetInstallationPath();
                        var buildToolsPath   = Path.Combine(installationPath, "MSBuild", "Current", "Bin");
                        if (!Directory.Exists(buildToolsPath))
                        {
                            buildToolsPath = null;
                        }
                        var idePath    = Path.Combine(installationPath, "Common7", "IDE");
                        var devenvPath = Path.Combine(idePath, "devenv.exe");
                        if (!File.Exists(devenvPath))
                        {
                            devenvPath = null;
                        }
                        var vsixInstallerPath = Path.Combine(idePath, "VSIXInstaller.exe");
                        if (!File.Exists(vsixInstallerPath))
                        {
                            vsixInstallerPath = null;
                        }

                        var displayName = inst2.GetDisplayName();
                        // Try to append nickname (if any)
                        try
                        {
                            var nickname = inst2.GetProperties().GetValue("nickname") as string;
                            if (!string.IsNullOrEmpty(nickname))
                            {
                                displayName = $"{displayName} ({nickname})";
                            }
                        }
                        catch (COMException)
                        {
                        }

                        try
                        {
                            var minimumRequiredState = InstanceState.Local | InstanceState.Registered;
                            if ((inst2.GetState() & minimumRequiredState) != minimumRequiredState)
                            {
                                continue;
                            }
                        }
                        catch (COMException)
                        {
                            continue;
                        }

                        var ideInfo = new IDEInfo(version, displayName, installationPath, inst2.IsComplete())
                        {
                            BuildToolsPath       = buildToolsPath,
                            DevenvPath           = devenvPath,
                            VsixInstallerVersion = VSIXInstallerVersion.VS2019AndFutureVersions,
                            VsixInstallerPath    = vsixInstallerPath,
                        };

                        // Fill packages
                        foreach (var package in inst2.GetPackages())
                        {
                            ideInfo.PackageVersions[package.GetId()] = package.GetVersion();
                        }

                        ideInfos.Add(ideInfo);
                    }
                    catch (Exception)
                    {
                        // Something might have happened inside Visual Studio Setup code (had FileNotFoundException in GetInstallationPath() for example)
                        // Let's ignore this instance
                    }
                }
            }
            catch (COMException comException) when(comException.HResult == REGDB_E_CLASSNOTREG)
            {
                // COM is not registered. Assuming no instances are installed.
            }
            return(ideInfos);
        }
Example #27
0
 static ManagerDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("Manager");
 }
Example #28
0
 static MenuDisplayNameDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("MenuDisplayName");
 }
Example #29
0
 static TaskPriorityTypeDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("TaskPriorityType");
 }
Example #30
0
 static CommissionRateDataManager()
 {
     DataStoreKey = SetupConfiguration.GetDataStoreKey("CommissionRate");
 }
Example #31
0
 static ApplicationUser()
 {
     ApplicationId = SetupConfiguration.ApplicationId;
     DataStoreKey  = SetupConfiguration.GetDataStoreKey("ApplicationUser");
 }