コード例 #1
0
        internal ProjectTemplateResult CreateAndOpenSolution(ProjectTemplateOptions options, string solutionDirectory, string solutionName)
        {
            FileName  solutionFileName = FileName.Create(Path.Combine(solutionDirectory, solutionName + ".sln"));
            bool      solutionOpened   = false;
            ISolution createdSolution  = SD.ProjectService.CreateEmptySolutionFile(solutionFileName);

            try {
                options.Solution       = createdSolution;
                options.SolutionFolder = createdSolution;
                var result = CreateProjects(options);
                if (result == null)
                {
                    return(null);
                }
                createdSolution.Save();                 // solution must be saved before it can be opened
                if (SD.ProjectService.OpenSolution(createdSolution))
                {
                    solutionOpened = true;
                    SD.GetRequiredService <IProjectServiceRaiseEvents>().RaiseSolutionCreated(new SolutionEventArgs(createdSolution));
                    return(result);
                }
                else
                {
                    return(null);
                }
            } finally {
                if (!solutionOpened)
                {
                    createdSolution.Dispose();
                }
            }
        }
コード例 #2
0
        public override void Execute(object parameter)
        {
            var classBrowser = SD.GetService <IClassBrowser>();

            if (classBrowser != null)
            {
                IAssemblyModel assemblyModel = parameter as IAssemblyModel;
                if (assemblyModel == null)
                {
                    // Node is a project?
                    IProject project = parameter as IProject;
                    if (project != null)
                    {
                        assemblyModel = project.AssemblyModel;
                    }
                }

                if (assemblyModel == null)
                {
                    // Node is an assembly reference?
                    IAssemblyReferenceModel assemblyReference = parameter as IAssemblyReferenceModel;
                    if (assemblyReference != null)
                    {
                        // Model is an assembly reference
                        IAssemblyParserService   assemblyParserService = SD.GetRequiredService <IAssemblyParserService>();
                        IEntityModelContext      entityModelContext    = assemblyReference.ParentAssemblyModel.Context;
                        CombinedAssemblySearcher searcher = new CombinedAssemblySearcher();
                        if ((entityModelContext != null) && (entityModelContext.Project != null))
                        {
                            searcher.AddSearcher(new ProjectAssemblyReferenceSearcher(entityModelContext.Project));
                        }
                        searcher.AddSearcher(new DefaultAssemblySearcher(assemblyReference.ParentAssemblyModel.Location));
                        var resolvedFile = searcher.FindAssembly(assemblyReference.AssemblyName);
                        if (resolvedFile != null)
                        {
                            assemblyModel = assemblyParserService.GetAssemblyModelSafe(resolvedFile);
                        }
                        else
                        {
                            // Assembly file not resolvable
                            SD.MessageService.ShowWarningFormatted("Could not resolve reference '{0}'.", assemblyReference.AssemblyName.ShortName);
                        }
                    }
                }

                if (assemblyModel != null)
                {
                    // Try to remove AssemblyModel from list of UnpinnedAssemblies
                    classBrowser.UnpinnedAssemblies.Assemblies.RemoveAll(a => a.FullAssemblyName == assemblyModel.FullAssemblyName);

                    if (!classBrowser.MainAssemblyList.Assemblies.Contains(assemblyModel))
                    {
                        classBrowser.MainAssemblyList.Assemblies.Add(assemblyModel);
                    }

                    // Bring the node into view
                    classBrowser.GotoAssemblyModel(assemblyModel);
                }
            }
        }
コード例 #3
0
        string getClipboardString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(Gui.AboutSharpDevelopTabPage.GetVersionInformationString());

            sb.AppendLine();

            if (message != null)
            {
                sb.AppendLine(message);
            }
            if (exceptionThrown != null)
            {
                sb.AppendLine("Exception thrown:");
                sb.AppendLine(exceptionThrown.ToString());
            }
            sb.AppendLine();
            sb.AppendLine("---- Recent log messages:");
            try {
                LogMessageRecorder.AppendRecentLogMessages(sb, log4net.LogManager.GetLogger(typeof(log4netLoggingService)));
            } catch (Exception ex) {
                sb.AppendLine("Failed to append recent log messages.");
                sb.AppendLine(ex.ToString());
            }
            sb.AppendLine();
            sb.AppendLine("---- Post-error application state information:");
            try {
                SD.GetRequiredService <ApplicationStateInfoService>().AppendFormatted(sb);
            } catch (Exception ex) {
                sb.AppendLine("Failed to append application state information.");
                sb.AppendLine(ex.ToString());
            }
            return(sb.ToString());
        }
コード例 #4
0
        public override void Run()
        {
            ITestService        testService = SD.GetRequiredService <ITestService>();
            IEnumerable <ITest> tests       = TestableCondition.GetTests(testService.OpenSolution, Owner);

            testService.RunTestsAsync(tests, new TestExecutionOptions()).FireAndForget();
        }
コード例 #5
0
ファイル: Solution.cs プロジェクト: cffjfz/SharpDevelop
        void FileServiceFileRenamed(object sender, FileRenameEventArgs e)
        {
            string oldName = e.SourceFile;
            string newName = e.TargetFile;

            foreach (ISolutionFileItem fileItem in this.AllItems.OfType <ISolutionFileItem>())
            {
                if (FileUtility.IsBaseDirectory(oldName, fileItem.FileName))
                {
                    string newFullName = FileUtility.RenameBaseDirectory(fileItem.FileName, oldName, newName);
                    fileItem.FileName = FileName.Create(newFullName);
                }
            }

            foreach (IProject project in this.Projects)
            {
                if (FileUtility.IsBaseDirectory(project.Directory, oldName))
                {
                    foreach (ProjectItem item in project.Items)
                    {
                        if (FileUtility.IsBaseDirectory(oldName, item.FileName))
                        {
                            SD.GetRequiredService <IProjectServiceRaiseEvents>().RaiseProjectItemRemoved(new ProjectItemEventArgs(project, item));
                            item.FileName = FileName.Create(FileUtility.RenameBaseDirectory(item.FileName, oldName, newName));
                            SD.GetRequiredService <IProjectServiceRaiseEvents>().RaiseProjectItemAdded(new ProjectItemEventArgs(project, item));
                        }
                    }
                }
            }
        }
コード例 #6
0
        public override void Run()
        {
            ITestService testService = SD.GetRequiredService <ITestService>();

            if (testService.OpenSolution != null)
            {
                testService.RunTestsAsync(new [] { testService.OpenSolution }, new TestExecutionOptions()).FireAndForget();
            }
        }
        public override void Run()
        {
            ITestService testService = SD.GetRequiredService <ITestService>();

            if (testService.OpenSolution != null)
            {
                base.Run();
            }
        }
コード例 #8
0
        public override void Run()
        {
            ITestService        testService = SD.GetRequiredService <ITestService>();
            IEnumerable <ITest> tests       = TestableCondition.GetTests(testService.OpenSolution, Owner);
            string path = tests.FirstOrDefault().ParentProject.Project.GetSessionFileName();

            testService.RunTestsAsync(tests, new TestExecutionOptions {
                ProcessRunner = new ProfilerProcessRunner(new ProfilingDataSQLiteWriter(path), new ProfilerOptions())
            }).FireAndForget();
        }
コード例 #9
0
 public TestExecutionManager()
 {
     this.buildService        = SD.BuildService;
     this.taskService         = new UnitTestTaskService();
     this.saveAllFilesCommand = new UnitTestSaveAllFilesCommand();
     this.testService         = SD.GetRequiredService <ITestService>();
     this.workbench           = SD.Workbench;
     this.statusBarService    = SD.StatusBar;
     this.mainThread          = SD.MainThread;
     this.buildOptions        = new UnitTestBuildOptions();
 }
コード例 #10
0
        static IAssemblyModel CreateAssemblyModel(Module module)
        {
            IEntityModelContext      context = new DebuggerProcessEntityModelContext(module.Process, module);
            IUpdateableAssemblyModel model   = SD.GetRequiredService <IModelFactory>().CreateAssemblyModel(context);
            var types = module.Assembly.TopLevelTypeDefinitions.SelectMany(td => td.Parts).ToList();

            model.AssemblyName     = module.UnresolvedAssembly.AssemblyName;
            model.FullAssemblyName = module.UnresolvedAssembly.FullAssemblyName;
            model.Update(EmptyList <IUnresolvedTypeDefinition> .Instance, types);
            model.UpdateReferences(module.GetReferences().Select(r => new DomAssemblyName(r)).ToArray());
            return(model);
        }
コード例 #11
0
        public override void Run()
        {
            ITestService testService = SD.GetRequiredService <ITestService>();

            if (testService.OpenSolution != null)
            {
                ITestProject project = testService.OpenSolution.GetTestProject(ProjectService.CurrentProject);
                if (project != null)
                {
                    testService.RunTestsAsync(new [] { project }, new TestExecutionOptions()).FireAndForget();
                }
            }
        }
コード例 #12
0
        ITypeDefinitionModel GetTypeDefinitionModel(ITypeDefinition mainTypeDefinition, ITypeDefinition derivedTypeDefinition)
        {
            ITypeDefinitionModel resolveTypeDefModel = null;
            var            assemblyFileName          = mainTypeDefinition.ParentAssembly.GetRuntimeAssemblyLocation();
            IAssemblyModel assemblyModel             = null;

            try {
                // Try to get AssemblyModel from project list
                IProjectService projectService = SD.GetRequiredService <IProjectService>();
                if (projectService.CurrentSolution != null)
                {
                    var projectOfAssembly = projectService.CurrentSolution.Projects.FirstOrDefault(p => p.AssemblyModel.Location == assemblyFileName);
                    if (projectOfAssembly != null)
                    {
                        // We automatically have an AssemblyModel from project
                        assemblyModel = projectOfAssembly.AssemblyModel;
                    }
                }

                if (assemblyModel == null)
                {
                    // Nothing in projects, load from assembly file
                    var assemblyParserService = SD.GetService <IAssemblyParserService>();
                    if (assemblyParserService != null)
                    {
                        if (assemblyFileName != null)
                        {
                            assemblyModel = assemblyParserService.GetAssemblyModel(assemblyFileName);
                        }
                    }
                }

                if (assemblyModel != null)
                {
                    // Look in found AssemblyModel
                    resolveTypeDefModel = assemblyModel.TopLevelTypeDefinitions[derivedTypeDefinition.FullTypeName];
                    if (resolveTypeDefModel != null)
                    {
                        return(resolveTypeDefModel);
                    }
                }
            } catch (Exception) {
                // TODO Can't load the type, what to do?
            }

            return(resolveTypeDefModel);
        }
コード例 #13
0
        static IAssemblyModel SafelyCreateAssemblyModelFromFile(string fileName)
        {
            var modelFactory = SD.GetRequiredService <IModelFactory>();

            try {
                return(SD.AssemblyParserService.GetAssemblyModel(new FileName(fileName), true));
            } catch (Exception) {
                // Special AssemblyModel for unresolved file references
                string fakedAssemblyName = Path.GetFileName(fileName);
                IEntityModelContext      unresolvedContext = new UnresolvedAssemblyEntityModelContext(fakedAssemblyName, fakedAssemblyName, fileName);
                IUpdateableAssemblyModel unresolvedModel   = modelFactory.CreateAssemblyModel(unresolvedContext);
                unresolvedModel.AssemblyName     = unresolvedContext.AssemblyName;
                unresolvedModel.FullAssemblyName = unresolvedContext.FullAssemblyName;

                return(unresolvedModel);
            }
        }
コード例 #14
0
        public override void Run()
        {
            ClearCodeCoverageResults();

            var coverageResultsReader = new CodeCoverageResultsReader();
            var options = new TestExecutionOptions {
                ModifyProcessStartInfoBeforeTestRun = (startInfo, tests) => {
                    OpenCoverApplication app = CreateOpenCoverApplication(startInfo, tests);
                    coverageResultsReader.AddResultsFile(app.CodeCoverageResultsFileName);
                    return(app.GetProcessStartInfo());
                }
            };

            ITestService        testService = SD.GetRequiredService <ITestService>();
            IEnumerable <ITest> allTests    = GetTests(testService);

            testService.RunTestsAsync(allTests, options)
            .ContinueWith(t => AfterTestsRunTask(t, coverageResultsReader))
            .FireAndForget();
        }
コード例 #15
0
        public ICSharpCode.Core.FileName FindAssembly(DomAssemblyName fullName)
        {
            // Try to find assembly among solution projects
            IProjectService projectService = SD.GetRequiredService <IProjectService>();

            ProjectItem projectItem =
                project.Items.FirstOrDefault(
                    item => {
                if (item.ItemType == ItemType.COMReference)
                {
                    // Special handling for COM references: Their assembly names are prefixed with "Interop."
                    return(fullName.ShortName == "Interop." + item.Include);
                }
                if ((item.ItemType == ItemType.ProjectReference) && (item is ProjectReferenceProjectItem))
                {
                    // Special handling for project references: Compare with project name instead of file name
                    return(((ProjectReferenceProjectItem)item).ProjectName == fullName.ShortName);
                }
                return((item.ItemType == ItemType.Reference) && (item.Include == fullName.ShortName));
            });

            if (projectItem != null)
            {
                if (projectItem is ProjectReferenceProjectItem)
                {
                    // This is a project reference, so FileName delivers the project file instead of assembly binary
                    IProject refProject = ((ProjectReferenceProjectItem)projectItem).ReferencedProject;
                    if (refProject != null)
                    {
                        return(refProject.OutputAssemblyFullPath);
                    }
                }
                else
                {
                    return(projectItem.FileName);
                }
            }

            return(null);
        }
コード例 #16
0
        public FileName FindAssembly(DomAssemblyName fullName)
        {
            // look for the assembly in the current loaded assembly lists
            var classBrowser = SD.GetRequiredService <IClassBrowser>();
            var relevantClassBrowserAssemblies = classBrowser.AssemblyLists
                                                 .Where(l => l.Assemblies.Any(a => a.Location == mainAssemblyFileName))
                                                 .SelectMany(l => l.Assemblies);

            foreach (var asm in relevantClassBrowserAssemblies)
            {
                if (asm.FullAssemblyName == fullName.FullName)
                {
                    return(asm.Location);
                }
            }

            // look in GAC
            var gacFileName = SD.GlobalAssemblyCache.FindAssemblyInNetGac(fullName);

            if (gacFileName != null)
            {
                return(gacFileName);
            }

            // scan current directory
            var fileName = baseDirectory.CombineFile(fullName.ShortName + ".dll");

            if (File.Exists(fileName))
            {
                return(fileName);
            }

            fileName = baseDirectory.CombineFile(fullName.ShortName + ".exe");
            if (File.Exists(fileName))
            {
                return(fileName);
            }
            return(null);
        }
コード例 #17
0
 public TestableCondition()
 {
     this.testService = SD.GetRequiredService <ITestService>();
 }
コード例 #18
0
        //Show prompt, create files from template, create project, execute command, save project
        public bool CreateProject(ProjectTemplateResult templateResults, string defaultLanguage, ISolutionFolder target)
        {
            var      projectCreateOptions = templateResults.Options;
            var      parentSolution       = templateResults.Options.Solution;
            IProject project = null;
            bool     success = false;

            try
            {
                string language = string.IsNullOrEmpty(languageName) ? defaultLanguage : languageName;
                ProjectBindingDescriptor descriptor   = SD.ProjectService.ProjectBindings.FirstOrDefault(b => b.Language == language);
                IProjectBinding          languageinfo = (descriptor != null) ? descriptor.Binding : null;

                if (languageinfo == null)
                {
                    MessageService.ShowError(
                        StringParser.Parse("${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.CantCreateProjectWithTypeError}",
                                           new StringTagPair("type", language)));
                    return(false);
                }

                DirectoryName projectBasePath = GetProjectBasePath(projectCreateOptions);
                string        newProjectName  = StringParser.Parse(name, new StringTagPair("ProjectName", projectCreateOptions.ProjectName));
                Directory.CreateDirectory(projectBasePath);
                FileName projectLocation      = projectBasePath.CombineFile(newProjectName + descriptor.ProjectFileExtension);
                ProjectCreateInformation info = new ProjectCreateInformation(parentSolution, projectLocation);
                info.TargetFramework = projectCreateOptions.TargetFramework;

                StringBuilder standardNamespace = new StringBuilder();
                // filter 'illegal' chars from standard namespace
                if (!string.IsNullOrEmpty(newProjectName))
                {
                    char ch = '.';
                    for (int i = 0; i < newProjectName.Length; ++i)
                    {
                        if (ch == '.')
                        {
                            // at beginning or after '.', only a letter or '_' is allowed
                            ch = newProjectName[i];
                            if (!Char.IsLetter(ch))
                            {
                                standardNamespace.Append('_');
                            }
                            else
                            {
                                standardNamespace.Append(ch);
                            }
                        }
                        else
                        {
                            ch = newProjectName[i];
                            // can only contain letters, digits or '_'
                            if (!Char.IsLetterOrDigit(ch) && ch != '.')
                            {
                                standardNamespace.Append('_');
                            }
                            else
                            {
                                standardNamespace.Append(ch);
                            }
                        }
                    }
                }

                info.TypeGuid      = descriptor.TypeGuid;
                info.RootNamespace = standardNamespace.ToString();
                info.ProjectName   = newProjectName;
                if (!string.IsNullOrEmpty(defaultPlatform))
                {
                    info.ActiveProjectConfiguration = new ConfigurationAndPlatform("Debug", defaultPlatform);
                }

                RunPreCreateActions(info);

                StringParserPropertyContainer.FileCreation["StandardNamespace"] = info.RootNamespace;

                if (File.Exists(projectLocation))
                {
                    if (!MessageService.AskQuestion(
                            StringParser.Parse("${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.OverwriteProjectQuestion}",
                                               new StringTagPair("projectLocation", projectLocation)),
                            "${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.OverwriteQuestion.InfoName}"))
                    {
                        return(false);                        //The user doesnt want to overwrite the project...
                    }
                }

                //Show prompt if any of the files exist
                StringBuilder existingFileNames = new StringBuilder();
                foreach (FileDescriptionTemplate file in files)
                {
                    string fileName = Path.Combine(projectBasePath, StringParser.Parse(file.Name, new StringTagPair("ProjectName", info.ProjectName)));

                    if (File.Exists(fileName))
                    {
                        if (existingFileNames.Length > 0)
                        {
                            existingFileNames.Append(", ");
                        }
                        existingFileNames.Append(Path.GetFileName(fileName));
                    }
                }

                bool overwriteFiles = true;
                if (existingFileNames.Length > 0)
                {
                    if (!MessageService.AskQuestion(
                            StringParser.Parse("${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.OverwriteQuestion}",
                                               new StringTagPair("fileNames", existingFileNames.ToString())),
                            "${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.OverwriteQuestion.InfoName}"))
                    {
                        overwriteFiles = false;
                    }
                }



                #region Copy files to target directory
                foreach (FileDescriptionTemplate file in files)
                {
                    string fileName = Path.Combine(projectBasePath, StringParser.Parse(file.Name, new StringTagPair("ProjectName", info.ProjectName)));
                    if (File.Exists(fileName) && !overwriteFiles)
                    {
                        continue;
                    }

                    try
                    {
                        if (!Directory.Exists(Path.GetDirectoryName(fileName)))
                        {
                            Directory.CreateDirectory(Path.GetDirectoryName(fileName));
                        }
                        if (!String.IsNullOrEmpty(file.BinaryFileName))
                        {
                            // Binary content
                            File.Copy(file.BinaryFileName, fileName, true);
                        }
                        else
                        {
                            // Textual content
                            StreamWriter sr          = new StreamWriter(File.Create(fileName), SD.FileService.DefaultFileEncoding);
                            string       fileContent = StringParser.Parse(file.Content,
                                                                          new StringTagPair("ProjectName", projectCreateOptions.ProjectName),
                                                                          new StringTagPair("SolutionName", projectCreateOptions.SolutionName),
                                                                          new StringTagPair("FileName", fileName));
                            fileContent = StringParser.Parse(fileContent);
                            if (SD.EditorControlService.GlobalOptions.IndentationString != "\t")
                            {
                                fileContent = fileContent.Replace("\t", SD.EditorControlService.GlobalOptions.IndentationString);
                            }
                            sr.Write(fileContent);
                            sr.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageService.ShowException(ex, "Exception writing " + fileName);
                    }
                }
                #endregion

                #region Create Project
                try {
                    info.InitializeTypeSystem = false;
                    project = languageinfo.CreateProject(info);
                } catch (ProjectLoadException ex) {
                    MessageService.ShowError(ex.Message);
                    return(false);
                }
                #endregion

                #region Create Project Items, Imports and Files
                // Add Project items
                if (!project.Items.IsReadOnly)
                {
                    foreach (ProjectItem projectItem in projectItems)
                    {
                        ProjectItem newProjectItem = new UnknownProjectItem(
                            project,
                            StringParser.Parse(projectItem.ItemType.ItemName),
                            StringParser.Parse(projectItem.Include,
                                               new StringTagPair("ProjectName", projectCreateOptions.ProjectName),
                                               new StringTagPair("SolutionName", projectCreateOptions.SolutionName))
                            );
                        foreach (string metadataName in projectItem.MetadataNames)
                        {
                            string metadataValue = projectItem.GetMetadata(metadataName);
                            // if the input contains any special MSBuild sequences, don't escape the value
                            // we want to escape only when the special characters are introduced by the StringParser.Parse replacement
                            if (metadataValue.Contains("$(") || metadataValue.Contains("%"))
                            {
                                newProjectItem.SetMetadata(StringParser.Parse(metadataName), StringParser.Parse(metadataValue));
                            }
                            else
                            {
                                newProjectItem.SetEvaluatedMetadata(StringParser.Parse(metadataName), StringParser.Parse(metadataValue));
                            }
                        }
                        project.Items.Add(newProjectItem);
                    }
                }

                // Add properties from <PropertyGroup>
                // This must be done before adding <Imports>, because the import path can refer to properties.
                if (projectProperties.Count > 0)
                {
                    if (!(project is MSBuildBasedProject))
                    {
                        throw new Exception("<PropertyGroup> may be only used in project templates for MSBuildBasedProjects");
                    }

                    foreach (ProjectProperty p in projectProperties)
                    {
                        ((MSBuildBasedProject)project).SetProperty(
                            StringParser.Parse(p.Configuration),
                            StringParser.Parse(p.Platform),
                            StringParser.Parse(p.Name),
                            StringParser.Parse(p.Value),
                            p.Location,
                            p.ValueIsLiteral
                            );
                    }
                }

                // Add Imports
                if (clearExistingImports || projectImports.Count > 0)
                {
                    MSBuildBasedProject msbuildProject = project as MSBuildBasedProject;
                    if (msbuildProject == null)
                    {
                        throw new Exception("<Imports> may be only used in project templates for MSBuildBasedProjects");
                    }
                    try {
                        msbuildProject.PerformUpdateOnProjectFile(
                            delegate {
                            var projectFile = msbuildProject.MSBuildProjectFile;
                            if (clearExistingImports)
                            {
                                foreach (var import in projectFile.Imports.ToArray())
                                {
                                    projectFile.RemoveChild(import);
                                }
                            }
                            foreach (Import projectImport in projectImports)
                            {
                                projectFile.AddImport(projectImport.Key).Condition = projectImport.Value;
                            }
                        });
                    } catch (InvalidProjectFileException ex) {
                        string message;
                        if (string.IsNullOrEmpty(importsFailureMessage))
                        {
                            message = "Error creating project:\n" + ex.Message;
                        }
                        else
                        {
                            message = importsFailureMessage + "\n\n" + ex.Message;
                        }
                        throw new ProjectLoadException(message, ex);
                    }
                }

                // Add Files
                if (!project.Items.IsReadOnly)
                {
                    foreach (FileDescriptionTemplate file in files)
                    {
                        string          fileName    = Path.Combine(projectBasePath, StringParser.Parse(file.Name, new StringTagPair("ProjectName", projectCreateOptions.ProjectName)));
                        FileProjectItem projectFile = new FileProjectItem(project, project.GetDefaultItemType(fileName));

                        projectFile.Include = FileUtility.GetRelativePath(project.Directory, fileName);

                        file.SetProjectItemProperties(projectFile);

                        project.Items.Add(projectFile);
                    }
                }

                #endregion

                RunCreateActions(project);

                project.ProjectCreationComplete();

                // Save project
                project.Save();

                // HACK : close and reload
                var fn = project.FileName;
                project.Dispose();
                ProjectLoadInformation loadInfo = new ProjectLoadInformation(parentSolution, fn, fn.GetFileNameWithoutExtension());
                project = SD.ProjectService.LoadProject(loadInfo);
                target.Items.Add(project);
                project.ProjectLoaded();

                SD.GetRequiredService <IProjectServiceRaiseEvents>().RaiseProjectCreated(new ProjectEventArgs(project));
                templateResults.NewProjects.Add(project);
                success = true;
                return(true);
            } finally {
                if (project != null && !success)
                {
                    project.Dispose();
                }
            }
        }
コード例 #19
0
        public bool IsValid(object caller, Condition condition)
        {
            ITestService testService = SD.GetRequiredService <ITestService>();

            return(testService.IsRunningTests);
        }
コード例 #20
0
 public ClassBrowserPad()
     : this(SD.GetRequiredService <IProjectService>())
 {
 }
コード例 #21
0
 public UnitTestsPad()
     : this(SD.GetRequiredService <ITestService>())
 {
 }
コード例 #22
0
        public override void Run()
        {
            ITestService testService = SD.GetRequiredService <ITestService>();

            testService.CancelRunningTests();
        }