Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public async ValueTask TryRemoveMiscellaneousDocumentAsync(DocumentUri uri, bool
// If it's a proper file based program, we'll put it in the main host workspace factory since we want cross-project references to work.
// Otherwise, we'll keep it in miscellaneous files.
ProjectFactory: isFileBasedProgram ? _workspaceFactory.HostProjectFactory : _workspaceFactory.MiscellaneousFilesWorkspaceProjectFactory,
HasAllInformation: isFileBasedProgram,
IsMiscellaneousFile: !isFileBasedProgram,
Preferred: buildHostKind,
Actual: buildHostKind);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private async ValueTask ReloadProjectsAsync(ImmutableSegmentedList<ProjectToLoad
}
}

protected sealed record RemoteProjectLoadResult(RemoteProjectFile ProjectFile, ProjectSystemProjectFactory ProjectFactory, bool HasAllInformation, BuildHostProcessKind Preferred, BuildHostProcessKind Actual);
protected sealed record RemoteProjectLoadResult(RemoteProjectFile ProjectFile, ProjectSystemProjectFactory ProjectFactory, bool IsMiscellaneousFile, BuildHostProcessKind Preferred, BuildHostProcessKind Actual);

/// <summary>Loads a project in the MSBuild host.</summary>
/// <remarks>Caller needs to catch exceptions to avoid bringing down the project loader queue.</remarks>
Expand Down Expand Up @@ -209,7 +209,7 @@ private async Task<bool> ReloadProjectAsync(ProjectToLoad projectToLoad, ToastEr
return false;
}

(RemoteProjectFile remoteProjectFile, ProjectSystemProjectFactory projectFactory, bool hasAllInformation, BuildHostProcessKind preferredBuildHostKind, BuildHostProcessKind actualBuildHostKind) = remoteProjectLoadResult;
(RemoteProjectFile remoteProjectFile, ProjectSystemProjectFactory projectFactory, bool isMiscellaneousFile, BuildHostProcessKind preferredBuildHostKind, BuildHostProcessKind actualBuildHostKind) = remoteProjectLoadResult;
if (preferredBuildHostKind != actualBuildHostKind)
preferredBuildHostKindThatWeDidNotGet = preferredBuildHostKind;

Expand Down Expand Up @@ -249,7 +249,7 @@ private async Task<bool> ReloadProjectAsync(ProjectToLoad projectToLoad, ToastEr
var (target, targetAlreadyExists) = await GetOrCreateProjectTargetAsync(previousProjectTargets, projectFactory, loadedProjectInfo);
newProjectTargetsBuilder.Add(target);

var (targetTelemetryInfo, targetNeedsRestore) = await target.UpdateWithNewProjectInfoAsync(loadedProjectInfo, hasAllInformation, _logger);
var (targetTelemetryInfo, targetNeedsRestore) = await target.UpdateWithNewProjectInfoAsync(loadedProjectInfo, isMiscellaneousFile, _logger);
needsRestore |= targetNeedsRestore;
if (!targetAlreadyExists)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ public async Task OpenProjectsAsync(ImmutableArray<string> projectFilePaths)
var (buildHost, actualBuildHostKind) = await buildHostProcessManager.GetBuildHostWithFallbackAsync(preferredBuildHostKind, projectPath, cancellationToken);

var loadedFile = await buildHost.LoadProjectFileAsync(projectPath, languageName, cancellationToken);
return new RemoteProjectLoadResult(loadedFile, _hostProjectFactory, HasAllInformation: true, preferredBuildHostKind, actualBuildHostKind);
return new RemoteProjectLoadResult(loadedFile, _hostProjectFactory, IsMiscellaneousFile: false, preferredBuildHostKind, actualBuildHostKind);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void Dispose()
_projectSystemProject.RemoveFromWorkspace();
}

public async ValueTask<(ProjectLoadTelemetryReporter.TelemetryInfo, bool NeedsRestore)> UpdateWithNewProjectInfoAsync(ProjectFileInfo newProjectInfo, bool hasAllInformation, ILogger logger)
public async ValueTask<(ProjectLoadTelemetryReporter.TelemetryInfo, bool NeedsRestore)> UpdateWithNewProjectInfoAsync(ProjectFileInfo newProjectInfo, bool isMiscellaneousFile, ILogger logger)
{
if (_mostRecentFileInfo != null)
{
Expand All @@ -126,23 +126,19 @@ public void Dispose()
var disposableBatchScope = await _projectSystemProject.CreateBatchScopeAsync(CancellationToken.None).ConfigureAwait(false);
await using var _ = disposableBatchScope.ConfigureAwait(false);

var projectDisplayName = Path.GetFileNameWithoutExtension(newProjectInfo.FilePath)!;
var projectFullPathWithTargetFramework = newProjectInfo.FilePath;

if (newProjectInfo.TargetFramework != null)
{
var targetFrameworkSuffix = " (" + newProjectInfo.TargetFramework + ")";
projectDisplayName += targetFrameworkSuffix;
projectFullPathWithTargetFramework += targetFrameworkSuffix;
}
var targetFrameworkSuffix = newProjectInfo.TargetFramework != null ? " (" + newProjectInfo.TargetFramework + ")" : "";
var projectDisplayName = isMiscellaneousFile
? FeaturesResources.Miscellaneous_Files
: Path.GetFileNameWithoutExtension(newProjectInfo.FilePath) + targetFrameworkSuffix;
var projectFullPathWithTargetFramework = newProjectInfo.FilePath + targetFrameworkSuffix;

_projectSystemProject.DisplayName = projectDisplayName;
_projectSystemProject.OutputFilePath = newProjectInfo.OutputFilePath;
_projectSystemProject.OutputRefFilePath = newProjectInfo.OutputRefFilePath;
_projectSystemProject.GeneratedFilesOutputDirectory = newProjectInfo.GeneratedFilesOutputDirectory;
_projectSystemProject.CompilationOutputAssemblyFilePath = newProjectInfo.IntermediateOutputFilePath;
_projectSystemProject.DefaultNamespace = newProjectInfo.DefaultNamespace;
_projectSystemProject.HasAllInformation = hasAllInformation;
_projectSystemProject.HasAllInformation = !isMiscellaneousFile;

if (newProjectInfo.TargetFrameworkIdentifier != null)
{
Expand Down
Loading