Пример #1
0
        public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            var destinationDirectory = replacementsDictionary["$destinationdirectory$"];

            try
            {
                DTE = (DTE)automationObject;
                Wizard.MakeSureSharedProjectExist(DTE);
                var form = new FormProject(ProjectType.CustomApi, DTE);
                if (form.ShowDialog() == DialogResult.Cancel)
                {
                    throw new WizardCancelledException();
                }
                //Creating project ...
                ProjectName = form.ProjectName;
                replacementsDictionary.Add("$Check$", form.Check);
                Wizard.ProcessProjectReplacementsDictionary(replacementsDictionary, form);
            }
            catch
            {
                if (Directory.Exists(destinationDirectory))
                {
                    Utility.TryDeleteDirectory(destinationDirectory);
                }
                throw;
            }
        }
Пример #2
0
        public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            var destinationDirectory = replacementsDictionary["$destinationdirectory$"];

            try
            {
                DTE = (DTE)automationObject;
                if (!Utility.SharedProjectExist(DTE))
                {
                    MessageBox.Show(@"Please add DynamicsCrm.DevKit Shared project and try it again", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw new WizardCancelledException();
                }
                var form = new FormProject(ProjectType.WebResource, DTE);
                if (form.ShowDialog() == DialogResult.Cancel)
                {
                    throw new WizardCancelledException();
                }
                //Creating project ...
                ProjectName = form.ProjectName;
                replacementsDictionary.Add("$Check$", form.Check);
                Wizard.ProcessProjectReplacementsDictionary(replacementsDictionary, form);
            }
            catch
            {
                if (Directory.Exists(destinationDirectory))
                {
                    Utility.TryDeleteDirectory(destinationDirectory);
                }
                throw;
            }
        }
Пример #3
0
        public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            var destinationDirectory = replacementsDictionary["$destinationdirectory$"];

            try
            {
                DTE = (DTE)automationObject;
                var form = new FormProject(ProjectType.Shared, DTE);
                if (form.ShowDialog() == DialogResult.Cancel)
                {
                    throw new WizardCancelledException();
                }

                var solutionPath = Path.GetDirectoryName(DTE?.Solution?.FullName);
                NugetHelper.DownoadDynamicsCrmDevKitPackage(solutionPath);

                //Creating project ...
                ProjectName = form.ProjectName;
                replacementsDictionary.Add("$Check$", form.Check);
                if (Utility.ExistProject(DTE, ProjectName))
                {
                    MessageBox.Show($@"{ProjectName} project exist!", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw new WizardCancelledException();
                }
                Wizard.ProcessProjectReplacementsDictionary(replacementsDictionary, form);
                var file = Utility.GetDevKitCliJsonFile(DTE);
                if (!File.Exists(file))
                {
                    var solutionName = Utility.GetSolutionName(DTE);
                    var json         = Utility.ReadEmbeddedResource("DynamicsCrm.DevKit.Resources.DynamicsCrm.DevKit.Cli.json");
                    json = json
                           .Replace("???.Plugin.*.dll", $"{solutionName}.Plugin.*.dll")
                           .Replace("???.CustomAction.*.dll", $"{solutionName}.CustomAction.*.dll")
                           .Replace("???.CustomApi.*.dll", $"{solutionName}.CustomApi.*.dll")
                           .Replace("???.Workflow.*.dll", $"{solutionName}.Workflow.*.dll")
                           .Replace("???.DataProvider.*.dll", $"{solutionName}.DataProvider.*.dll")
                           .Replace("???.*.Test.dll", $"{solutionName}.*.Test.dll")
                    ;
                    Utility.ForceWriteAllText(file, json);
                }
            }
            catch
            {
                if (Directory.Exists(destinationDirectory))
                {
                    Utility.TryDeleteDirectory(destinationDirectory);
                }
                throw;
            }
        }
Пример #4
0
        public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            var destinationDirectory = replacementsDictionary["$destinationdirectory$"];

            try
            {
                DTE = (DTE)automationObject;
                if (!Utility.SharedProjectExist(DTE))
                {
                    MessageBox.Show(@"Please add DynamicsCrm.DevKit Shared project and try it again", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw new WizardCancelledException();
                }
                if (!Utility.ProxyTypesProjectExist(DTE))
                {
                    MessageBox.Show(@"Please add DynamicsCrm.DevKit ProxyTypes project and try it again", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw new WizardCancelledException();
                }
                var form = new FormProject(ProjectType.Test, DTE);
                if (form.ShowDialog() == DialogResult.Cancel)
                {
                    throw new WizardCancelledException();
                }
                //Creating project ...
                ProjectName = form.ProjectName;
                Wizard.ProcessProjectReplacementsDictionary(replacementsDictionary, form);
                var runsettings = Utility.GetTestRunSettingsFile(DTE);
                if (!File.Exists(runsettings))
                {
                    var text = Utility.ReadEmbeddedResource("DynamicsCrm.DevKit.Resources.VsTest.runsettings");
                    if (text.Length > 0)
                    {
                        text = text.Replace("[[ProxyTypes.dll]]", Utility.GetProxyTypesProject(DTE) + ".dll");
                        text = text.Replace("[[Namespace]]", replacementsDictionary["$specifiedsolutionname$"]);
                        Utility.ForceWriteAllText(runsettings, text);
                    }
                }
            }
            catch
            {
                if (Directory.Exists(destinationDirectory))
                {
                    Utility.TryDeleteDirectory(destinationDirectory);
                }
                throw;
            }
        }