Exemplo n.º 1
0
        public static void ProcessProjectConsoleReplacementsDictionary(Dictionary <string, string> replacementsDictionary, FormProject form)
        {
            var ClientIdName      = form?.CrmConnection?.Type == "ClientSecret" ? "ClientId" : "Username";
            var ClientSecretName  = form?.CrmConnection?.Type == "ClientSecret" ? "ClientSecret" : "Password";
            var AuthTypeValue     = form?.CrmConnection?.Type;
            var UrlValue          = form?.CrmConnection?.Url;
            var ClientIdValue     = form?.CrmConnection?.UserName;
            var ClientSecretValue = form?.CrmConnection?.Type == "ClientSecret" ? form?.CrmConnection?.Password : EncryptDecrypt.DecryptString(form?.CrmConnection?.Password);

            replacementsDictionary.Add("$ClientId$", ClientIdName ?? string.Empty);
            replacementsDictionary.Add("$ClientSecret$", ClientSecretName ?? string.Empty);
            replacementsDictionary.Add("$AuthTypeValue$", AuthTypeValue ?? string.Empty);
            replacementsDictionary.Add("$UrlValue$", UrlValue ?? string.Empty);
            replacementsDictionary.Add("$ClientIdValue$", ClientIdValue ?? string.Empty);
            replacementsDictionary.Add("$ClientSecretValue$", ClientSecretValue ?? string.Empty);
        }
Exemplo n.º 2
0
        public static void ProcessProjectReplacementsDictionary(Dictionary <string, string> replacementsDictionary, FormProject form)
        {
            replacementsDictionary.Add("$CrmConnectionString$", form.WizardCrmConnectionString);
            replacementsDictionary.Add("$ShortCrmName$", form.WizardShortCrmName);
            replacementsDictionary.Add("$NameSpace$", Utility.SafeNamespace(form.WizardNameSpace));
            var nameSpace = Utility.SafeNamespace(form.WizardNameSpace);

            if (nameSpace.Contains($".{ProjectType.Plugin.ToString()}."))
            {
                replacementsDictionary.Add("$NameSpacePlugin$", nameSpace.Replace($".{ItemType.Plugin.ToString()}.", $".{ItemType.Plugin.ToString()}"));
            }
            else
            {
                replacementsDictionary.Add("$NameSpacePlugin$", nameSpace);
            }
            replacementsDictionary.Add("$DevKitVersion$", Const.Version);
            replacementsDictionary.Add("$SharedProject$", Utility.GetSharedProject(form.DTE));
            replacementsDictionary.Add("$ProjectName$", form.ProjectName);
            replacementsDictionary.Add("$LogicalProjectName$", form.ProjectName.ToLower());

            replacementsDictionary.Add("$ProjectNetVersion$", Utility.GetProjectNetVersion(form.ComboBoxCrmName));
            replacementsDictionary.Add("$CrmUrl$", form?.CrmConnection?.Url ?? string.Empty);
            replacementsDictionary.Add("$CrmUserName$", form?.CrmConnection?.UserName ?? string.Empty);

            replacementsDictionary.Add("$DynamicsCrm.DevKit.Cli.Version$", NugetHelper.GetLatestPackageVersion(Const.DynamicsCrmDevKitCli));
            replacementsDictionary.Add("$DynamicsCrm.DevKit.Analyzers.Version$", NugetHelper.GetLatestPackageVersion(Const.DynamicsCrmDevKitAnalyzers));

            replacementsDictionary.Add("$WebApiClientMin$", Utility.GetWebApiClientMin(form.ProjectJsName));
            replacementsDictionary.Add("$ProjectJsName$", form.ProjectJsName);

            var CoreAssemblies = NugetHelper.GetLatestPackageVersion(Const.MicrosoftCrmSdkCoreAssemblies, form.ComboBoxCrmName);

            replacementsDictionary.Add("$Microsoft.CrmSdk.CoreAssemblies.Version$", CoreAssemblies.Version);
            if (form.ComboBoxCrmName.StartsWith(Const.DynamicsCrm2013) || form.ComboBoxCrmName.StartsWith(Const.DynamicsCrm2015))
            {
                CoreAssemblies.TargetFramework = "45";
            }
            replacementsDictionary.Add("$Microsoft.CrmSdk.CoreAssemblies.TargetFramework$", CoreAssemblies.TargetFramework);

            var Workflow = NugetHelper.GetLatestPackageVersion(Const.MicrosoftCrmSdkWorkflow, form.ComboBoxCrmName);

            replacementsDictionary.Add("$Microsoft.CrmSdk.Workflow.Version$", Workflow.Version);
            replacementsDictionary.Add("$Microsoft.CrmSdk.Workflow.TargetFramework$", Workflow.TargetFramework);

            var Data = NugetHelper.GetLatestPackageVersion(Const.MicrosoftCrmSdkData, form.ComboBoxCrmName);

            replacementsDictionary.Add("$Microsoft.CrmSdk.Data.Version$", Data.Version);
            replacementsDictionary.Add("$Microsoft.CrmSdk.Data.TargetFramework$", Data.TargetFramework);

            var coreToolsVersion = NugetHelper.GetLatestPackageVersion(Const.MicrosoftCrmSdkCoreTools);

            replacementsDictionary.Add("$Microsoft.CrmSdk.CoreTools.Version$", coreToolsVersion);

            if (form.ProjectType == ProjectType.Test || form.ProjectType == ProjectType.Console)
            {
                var Deployment = NugetHelper.GetLatestPackageVersion(Const.MicrosoftCrmSdkDeployment, form.ComboBoxCrmName);
                replacementsDictionary.Add("$Microsoft.CrmSdk.Deployment.Version$", Deployment.Version);
                replacementsDictionary.Add("$Microsoft.CrmSdk.Deployment.TargetFramework$", Deployment.TargetFramework);
                if (form.ComboBoxCrmName != Const.DynamicsCrm2011)
                {
                    var CoreAssembly = NugetHelper.GetLatestPackageVersion(Const.MicrosoftCrmSdkXrmToolingCoreAssembly, form.ComboBoxCrmName);
                    replacementsDictionary.Add("$Microsoft.CrmSdk.XrmTooling.CoreAssembly.Version$", CoreAssembly.Version);
                    replacementsDictionary.Add("$Microsoft.CrmSdk.XrmTooling.CoreAssembly.TargetFramework$", CoreAssembly.TargetFramework);

                    var WpfControls = NugetHelper.GetLatestPackageVersion(Const.MicrosoftCrmSdkXrmToolingWpfControls, form.ComboBoxCrmName);
                    replacementsDictionary.Add("$Microsoft.CrmSdk.XrmTooling.WpfControls.Version$", WpfControls.Version);
                    replacementsDictionary.Add("$Microsoft.CrmSdk.XrmTooling.WpfControls.TargetFramework$", WpfControls.TargetFramework);
                }
                var shortPackage = "." + form.WizardShortCrmName;
                if (shortPackage == ".365")
                {
                    shortPackage = ".9";
                }
                else if (shortPackage == ".2011")
                {
                    shortPackage = string.Empty;
                }
                var fakeXrmEasyPackage = "FakeXrmEasy" + shortPackage;
                replacementsDictionary.Add("$FakeXrmEasy.Package$", fakeXrmEasyPackage);
                var fakeXrmEasyVersion = NugetHelper.GetLatestPackageVersion(fakeXrmEasyPackage);
                replacementsDictionary.Add("$FakeXrmEasy.Version$", fakeXrmEasyVersion);
                var fakeXrmEasyTargetFramework = NugetHelper.GetLatestPackageTargetFramework(fakeXrmEasyPackage);
                replacementsDictionary.Add("$FakeXrmEasy.TargetFramework$", fakeXrmEasyTargetFramework);
                replacementsDictionary.Add("$ProjectNameTested$", form.ProjectName.Substring(0, form.ProjectName.Length - ".Test".Length));
                replacementsDictionary.Add("$ProjectProxyTypes$", Utility.GetProxyTypesProject(form.DTE));
            }
            else if (form.ProjectType == ProjectType.UiTest)
            {
                replacementsDictionary.Add("$Dynamics365.UIAutomation.Api.Version$", NugetHelper.GetLatestPackageVersion(Const.Dynamics365UIAutomationApi));
                replacementsDictionary.Add("$Dynamics365.UIAutomation.Api.TargetFramework$", NugetHelper.GetLatestPackageTargetFramework(Const.Dynamics365UIAutomationApi));
                replacementsDictionary.Add("$Selenium.Chrome.WebDriver.Version$", NugetHelper.GetLatestPackageVersion(Const.SeleniumChromeWebDriver));
                replacementsDictionary.Add("$Selenium.Support.Version$", NugetHelper.GetLatestPackageVersion(Const.SeleniumSupport));
                replacementsDictionary.Add("$Selenium.Support.TargetFramework$", NugetHelper.GetLatestPackageTargetFramework(Const.SeleniumSupport));
                replacementsDictionary.Add("$Selenium.WebDriver.Version$", NugetHelper.GetLatestPackageVersion(Const.SeleniumWebDriver));
                replacementsDictionary.Add("$Selenium.WebDriver.TargetFramework$", NugetHelper.GetLatestPackageTargetFramework(Const.SeleniumWebDriver));
                ProcessProjectConsoleReplacementsDictionary(replacementsDictionary, form);
                var CoreAssembly = NugetHelper.GetLatestPackageVersion(Const.MicrosoftCrmSdkXrmToolingCoreAssembly, form.ComboBoxCrmName);
                replacementsDictionary.Add("$Microsoft.CrmSdk.XrmTooling.CoreAssembly.Version$", CoreAssembly.Version);
                replacementsDictionary.Add("$Microsoft.CrmSdk.XrmTooling.CoreAssembly.TargetFramework$", CoreAssembly.TargetFramework);
                var Deployment = NugetHelper.GetLatestPackageVersion(Const.MicrosoftCrmSdkDeployment, form.ComboBoxCrmName);
                replacementsDictionary.Add("$Microsoft.CrmSdk.Deployment.Version$", Deployment.Version);
                replacementsDictionary.Add("$Microsoft.CrmSdk.Deployment.TargetFramework$", Deployment.TargetFramework);
            }
        }