Skip to content

Commit

Permalink
Merge pull request #18360 from Pilchie/dpl-cleanup-netcore
Browse files Browse the repository at this point in the history
Don't create deferred projects for things that opt-out of DPL
  • Loading branch information
Pilchie authored Apr 7, 2017
2 parents 271f59e + 15d8623 commit f86e6a1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 27 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,7 @@ public void OnAfterCloseSolution()

if (_deferredLoadWasEnabledForLastSolution)
{
// Copy to avoid modifying the collection while enumerating
var loadedProjects = ImmutableProjects.ToList();
foreach (var p in loadedProjects)
foreach (var p in ImmutableProjects)
{
p.Disconnect();
}
Expand Down Expand Up @@ -690,6 +688,12 @@ private AbstractProject GetOrCreateProjectFromArgumentsAndReferences(
return null;
}

var solution7 = (IVsSolution7)_vsSolution;
if (!solution7.IsDeferredProjectLoadAllowed(projectFilename))
{
return null;
}

var commandLineParser = _workspaceServices.GetLanguageServices(languageName).GetService<ICommandLineParserService>();
var projectDirectory = PathUtilities.GetDirectoryName(projectFilename);
var commandLineArguments = commandLineParser.Parse(
Expand All @@ -698,7 +702,7 @@ private AbstractProject GetOrCreateProjectFromArgumentsAndReferences(
isInteractive: false,
sdkDirectory: RuntimeEnvironment.GetRuntimeDirectory());

// TODO: Should come from sln file?
// TODO: Should come from .sln file?
var projectName = PathUtilities.GetFileName(projectFilename, includeExtension: false);

// `AbstractProject` only sets the filename if it actually exists. Since we want
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,18 @@ int IVsSolutionEvents.OnAfterCloseSolution(object pUnkReserved)
return VSConstants.S_OK;
}

/// <summary>
/// Returns whether the solution overall has Lightweight solution load enabled, either
/// through the global option in Tools\Options, or the .suo specific option.
///
/// NOTE: Does *NOT* mean that all projects in the solution are deferred. Project types
/// can opt out. Use <see cref="IVsSolution7.IsDeferredProjectLoadAllowed(string)"/> to
/// see if a specific project can be deferred.
/// </summary>
internal static bool IsDeferredSolutionLoadEnabled(IServiceProvider serviceProvider)
{
// NOTE: It is expected that the "as" will fail on Dev14, as IVsSolution7 was
// introduced in Dev15. Be sure to handle the null result here.
var solution7 = serviceProvider.GetService(typeof(SVsSolution)) as IVsSolution7;
return solution7?.IsSolutionLoadDeferred() == true;
var solution7 = (IVsSolution7)serviceProvider.GetService(typeof(SVsSolution));
return solution7.IsSolutionLoadDeferred();
}

}
}
1 change: 0 additions & 1 deletion src/VisualStudio/Core/Def/ServicesVisualStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
<Compile Include="Implementation\Preview\ReferenceChange.cs" />
<Compile Include="Implementation\ProjectSystem\CPS\ICodeModelFactory.cs" />
<Compile Include="Implementation\ProjectSystem\IDeferredProjectWorkspaceService.cs" />
<Compile Include="Implementation\ProjectSystem\Interop\IVsSolution7.cs" />
<Compile Include="Implementation\ProjectSystem\Legacy\AbstractLegacyProject_ICompilerOptionsHostObject.cs" />
<Compile Include="Implementation\ProjectSystem\Legacy\AbstractLegacyProject_IIntellisenseBuildTarget.cs" />
<Compile Include="Implementation\ProjectSystem\CPS\IWorkspaceProjectContextFactory.cs" />
Expand Down
3 changes: 2 additions & 1 deletion src/VisualStudio/Core/Def/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"Microsoft.VisualStudio.Shell.Interop.10.0": "10.0.30319",
"Microsoft.VisualStudio.Shell.Interop.11.0": "11.0.61030",
"Microsoft.VisualStudio.Shell.Interop.12.1.DesignTime": "12.1.30328",
"Microsoft.VisualStudio.Shell.15.0": "15.0.26201-alpha",
"Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime": "14.3.25407",
"Microsoft.VisualStudio.Shell.Interop.15.0.DesignTime": "15.0.26201-alpha",
"Microsoft.VisualStudio.Shell.15.0": "15.0.26201-alpha",
"Microsoft.VisualStudio.Shell.Framework": "15.0.26201-alpha",
"Microsoft.VisualStudio.Shell.Immutable.10.0": "15.0.26201-alpha",
"Microsoft.VisualStudio.Editor": "15.0.26201-alpha",
Expand Down
1 change: 0 additions & 1 deletion src/VisualStudio/Core/Next/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime": "14.3.25407",
"Microsoft.ServiceHub.Client": "1.0.177-rc-g56d40a8a02",
"Newtonsoft.Json": "8.0.3",
"Microsoft.VisualStudio.Shell.Interop.15.0.DesignTime": "15.0.26201-alpha",
"RoslynDependencies.Microsoft.VisualStudio.Workspace": "14.0.983-pre-ge167e81694",
"System.Collections.Immutable": "1.3.1",
"Microsoft.Tpl.Dataflow": "4.5.24",
Expand Down

0 comments on commit f86e6a1

Please sign in to comment.