public CSharpProjectShim( ICSharpProjectRoot projectRoot, VisualStudioProjectTracker projectTracker, Func<ProjectId, IVsReportExternalErrors> reportExternalErrorCreatorOpt, string projectSystemName, IVsHierarchy hierarchy, IServiceProvider serviceProvider, MiscellaneousFilesWorkspace miscellaneousFilesWorkspaceOpt, VisualStudioWorkspaceImpl visualStudioWorkspaceOpt, HostDiagnosticUpdateSource hostDiagnosticUpdateSourceOpt) : base(projectTracker, reportExternalErrorCreatorOpt, projectSystemName, hierarchy, LanguageNames.CSharp, serviceProvider, miscellaneousFilesWorkspaceOpt, visualStudioWorkspaceOpt, hostDiagnosticUpdateSourceOpt) { _projectRoot = projectRoot; _warningNumberArrayPointer = Marshal.AllocHGlobal(0); InitializeOptions(); projectTracker.AddProject(this); }
public CSharpProjectShim( ICSharpProjectRoot projectRoot, VisualStudioProjectTracker projectTracker, Func<ProjectId, IVsReportExternalErrors> reportExternalErrorCreatorOpt, string projectSystemName, IVsHierarchy hierarchy, IServiceProvider serviceProvider, VisualStudioWorkspaceImpl visualStudioWorkspaceOpt, HostDiagnosticUpdateSource hostDiagnosticUpdateSourceOpt, ICommandLineParserService commandLineParserServiceOpt) : base(projectTracker, reportExternalErrorCreatorOpt, projectSystemName, hierarchy, LanguageNames.CSharp, serviceProvider, visualStudioWorkspaceOpt, hostDiagnosticUpdateSourceOpt, commandLineParserServiceOpt) { _projectRoot = projectRoot; _warningNumberArrayPointer = Marshal.AllocHGlobal(0); // Ensure the default options are set up ResetAllOptions(); UpdateOptions(); projectTracker.AddProject(this); }
public void BindToProject(ICSharpProjectRoot projectRoot, IVsHierarchy hierarchy) { var projectName = Path.GetFileName(projectRoot.GetFullProjectName()); // GetFullProjectName returns the path to the project file w/o the extension? var project = new CSharpProjectShimWithServices( projectRoot, this.Workspace.ProjectTracker, id => new ProjectExternalErrorReporter(id, "CS", this.SystemServiceProvider), projectName, hierarchy, this.SystemServiceProvider, this.Workspace, this.HostDiagnosticUpdateSource); projectRoot.SetProjectSite(project); }
/// <summary> /// Given a ICSharpProjectRoot instance, it returns the ProjectSite instance, throwing if it /// could not be obtained. /// </summary> private static CSharpProject GetProjectSite(ICSharpProjectRoot project) { // Get the host back for the project Guid projectSiteGuid = typeof(ICSharpProjectSite).GUID; CSharpProject projectSite = project.GetProjectSite(ref projectSiteGuid) as CSharpProject; // We should have gotten a ProjectSite back. If we didn't, that means we're being given // a project site that we didn't get BindToProject called on first which is a no-no by // the project system. if (projectSite == null) { throw new ArgumentException("finalProject was not properly sited with the languageServices service.", "finalProject"); } return projectSite; }
public void RemoveReferenceToCodeDirectory(string assemblyFileName, ICSharpProjectRoot project) { CSharpProject projectSite = GetProjectSite(project); if (!this.CurrentProjectReferencesContains(projectSite.Id)) { throw new ArgumentException("The finalProject reference is not currently referenced by this finalProject.", "finalProject"); } var projectReferences = GetCurrentProjectReferences().Where(r => r.ProjectId == projectSite.Id); foreach (var projectReference in projectReferences) { RemoveProjectReference(projectReference); } }
public void BindToProject(ICSharpProjectRoot projectRoot, IVsHierarchy hierarchy) { var projectName = Path.GetFileName(projectRoot.GetFullProjectName()); // GetFullProjectName returns the path to the project file w/o the extension? Workspace.ProjectTracker.TryDisconnectExistingDeferredProject(hierarchy, projectName); var project = new CSharpProjectShimWithServices( projectRoot, this.Workspace.ProjectTracker, id => new ProjectExternalErrorReporter(id, "CS", this.SystemServiceProvider), projectName, hierarchy, this.SystemServiceProvider, this.Workspace, this.HostDiagnosticUpdateSource, this.Workspace.Services.GetLanguageServices(LanguageNames.CSharp).GetService<ICommandLineParserService>()); projectRoot.SetProjectSite(project); }
public CSharpProjectShimWithServices( ICSharpProjectRoot projectRoot, VisualStudioProjectTracker projectTracker, Func<ProjectId, IVsReportExternalErrors> reportExternalErrorCreatorOpt, string projectSystemName, IVsHierarchy hierarchy, IServiceProvider serviceProvider, VisualStudioWorkspaceImpl visualStudioWorkspaceOpt, HostDiagnosticUpdateSource hostDiagnosticUpdateSourceOpt) : base( projectRoot, projectTracker, reportExternalErrorCreatorOpt, projectSystemName, hierarchy, serviceProvider, visualStudioWorkspaceOpt, hostDiagnosticUpdateSourceOpt) { }
public CSharpProjectShimWithServices( ICSharpProjectRoot projectRoot, VisualStudioProjectTracker projectTracker, Func <ProjectId, IVsReportExternalErrors> reportExternalErrorCreatorOpt, string projectSystemName, IVsHierarchy hierarchy, IServiceProvider serviceProvider, VisualStudioWorkspaceImpl visualStudioWorkspaceOpt, HostDiagnosticUpdateSource hostDiagnosticUpdateSourceOpt, ICommandLineParserService commandLineParserServiceOpt) : base( projectRoot, projectTracker, reportExternalErrorCreatorOpt, projectSystemName, hierarchy, serviceProvider, visualStudioWorkspaceOpt, hostDiagnosticUpdateSourceOpt, commandLineParserServiceOpt) { }
public CSharpProjectShim( ICSharpProjectRoot projectRoot, VisualStudioProjectTracker projectTracker, Func <ProjectId, IVsReportExternalErrors> reportExternalErrorCreatorOpt, string projectSystemName, IVsHierarchy hierarchy, IServiceProvider serviceProvider, MiscellaneousFilesWorkspace miscellaneousFilesWorkspaceOpt, VisualStudioWorkspaceImpl visualStudioWorkspaceOpt, HostDiagnosticUpdateSource hostDiagnosticUpdateSourceOpt) : base(projectTracker, reportExternalErrorCreatorOpt, projectSystemName, hierarchy, serviceProvider, miscellaneousFilesWorkspaceOpt, visualStudioWorkspaceOpt, hostDiagnosticUpdateSourceOpt) { _projectRoot = projectRoot; _warningNumberArrayPointer = Marshal.AllocHGlobal(0); }
public override void Disconnect() { _projectRoot = null; base.Disconnect(); }
public override void Disconnect() { _projectRoot = null; base.Disconnect(); }
public void AddReferenceToCodeDirectoryEx(string assemblyFileName, ICSharpProjectRoot project, CompilerOptions optionID) { CSharpProject projectSite = GetProjectSite(project); AddProjectReference(new ProjectReference(projectSite.Id)); }
public void OnCodeDirectoryAliasesChanged(ICSharpProjectRoot project, int previousAliasesCount, string[] previousAliases, int currentAliasesCount, string[] currentAliases) { CSharpProject projectSite = GetProjectSite(project); UpdateProjectReferenceAliases(projectSite, ImmutableArray.Create(currentAliases)); }
public void AddReferenceToCodeDirectory(string assemblyFileName, ICSharpProjectRoot project) { AddReferenceToCodeDirectoryEx(assemblyFileName, project, CompilerOptions.OPTID_IMPORTS); }
public void AddReferenceToCodeDirectoryEx(string assemblyFileName, ICSharpProjectRoot projectRoot, CompilerOptions optionID) { var projectSite = GetProjectSite(projectRoot); VisualStudioProject.AddProjectReference(new ProjectReference(projectSite.VisualStudioProject.Id, embedInteropTypes: optionID == CompilerOptions.OPTID_IMPORTSUSINGNOPIA)); }
public void AddReferenceToCodeDirectoryEx(string assemblyFileName, ICSharpProjectRoot project, CompilerOptions optionID) { CSharpProject projectSite = GetProjectSite(project); AddProjectReference(new ProjectReference(projectSite.Id)); }
public void OnCodeDirectoryAliasesChanged(ICSharpProjectRoot project, int previousAliasesCount, string[] previousAliases, int currentAliasesCount, string[] currentAliases) { CSharpProject projectSite = GetProjectSite(project); UpdateProjectReferenceAliases(projectSite, ImmutableArray.Create(currentAliases)); }
public void AddReferenceToCodeDirectory(string assemblyFileName, ICSharpProjectRoot project) { AddReferenceToCodeDirectoryEx(assemblyFileName, project, CompilerOptions.OPTID_IMPORTS); }