diff --git a/src/VisualStudio/Core/Def/ProjectSystem/CPS/IWorkspaceProjectContextFactory.cs b/src/VisualStudio/Core/Def/ProjectSystem/CPS/IWorkspaceProjectContextFactory.cs index 9bc7159e1e56e..98f3094bee6d8 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/CPS/IWorkspaceProjectContextFactory.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/CPS/IWorkspaceProjectContextFactory.cs @@ -15,29 +15,6 @@ namespace Microsoft.VisualStudio.LanguageServices.ProjectSystem; /// internal interface IWorkspaceProjectContextFactory { - /// - /// Creates and initializes a new Workspace project and returns a to lazily initialize the properties and items for the - /// project. This method guarantees that either the project is added (and the returned task - /// completes) or cancellation is observed and no project is added. - /// - /// Project language. - /// Unique name for the project. - /// Full path to the project file for the project. - /// Project guid. - /// The IVsHierarchy for the project; this is used to track linked files across multiple projects when determining contexts. - /// Initial project binary output path. - [Obsolete] - Task CreateProjectContextAsync( - string languageName, - string projectUniqueName, - string projectFilePath, - Guid projectGuid, - object? hierarchy, - string? binOutputPath, - string? assemblyName, - CancellationToken cancellationToken); - /// /// Creates and initializes a new project and returns a to lazily initialize the properties and items for the diff --git a/src/VisualStudio/Core/Impl/ProjectSystem/CPS/CPSProjectFactory.cs b/src/VisualStudio/Core/Impl/ProjectSystem/CPS/CPSProjectFactory.cs index 7abe1ea5cdef9..32b413a3d2dd4 100644 --- a/src/VisualStudio/Core/Impl/ProjectSystem/CPS/CPSProjectFactory.cs +++ b/src/VisualStudio/Core/Impl/ProjectSystem/CPS/CPSProjectFactory.cs @@ -57,58 +57,6 @@ public ImmutableArray EvaluationPropertyNames public ImmutableArray EvaluationItemNames => BuildPropertyNames.InitialEvaluationItemNames; - // Kept around onyl for integration tests. - [Obsolete] - public Task CreateProjectContextAsync( - string languageName, - string projectUniqueName, - string? projectFilePath, - Guid projectGuid, - object? hierarchy, - string? binOutputPath, - string? assemblyName, - CancellationToken cancellationToken) - { - var data = new IntegrationTestEvaluationData(projectFilePath ?? "", projectFilePath ?? "", assemblyName ?? "", binOutputPath ?? "", "SHA256"); - return CreateProjectContextAsync(projectGuid, projectUniqueName, languageName, data, hierarchy, cancellationToken); - } - - [Obsolete] - internal sealed class IntegrationTestEvaluationData : EvaluationData - { - public string ProjectFilePath { get; } - public string TargetPath { get; } - public string AssemblyName { get; } - public string OutputAssembly { get; } - public string ChecksumAlgorithm { get; } - - public IntegrationTestEvaluationData(string projectFilePath, string targetPath, string assemblyName, string outputAssembly, string checksumAlgorithm) - { - ProjectFilePath = projectFilePath; - TargetPath = targetPath; - AssemblyName = assemblyName; - OutputAssembly = outputAssembly; - ChecksumAlgorithm = checksumAlgorithm; - } - - public override string GetPropertyValue(string name) - => name switch - { - BuildPropertyNames.MSBuildProjectFullPath => ProjectFilePath, - BuildPropertyNames.TargetPath => TargetPath, - BuildPropertyNames.AssemblyName => AssemblyName, - BuildPropertyNames.CommandLineArgsForDesignTimeEvaluation => "-checksumalgorithm:" + ChecksumAlgorithm, - _ => throw ExceptionUtilities.UnexpectedValue(name) - }; - - public override ImmutableArray GetItemValues(string name) - => name switch - { - BuildPropertyNames.IntermediateAssembly => [OutputAssembly], - _ => throw ExceptionUtilities.UnexpectedValue(name) - }; - } - public async Task CreateProjectContextAsync(Guid id, string uniqueName, string languageName, EvaluationData data, object? hostObject, CancellationToken cancellationToken) { // Read all required properties from EvaluationData before we start updating anything. @@ -203,11 +151,13 @@ public async Task CreateProjectContextAsync(Guid id, s const string itemName = BuildPropertyNames.IntermediateAssembly; var values = data.GetItemValues(itemName); - if (values.Length != 1) + if (values.Length > 1) + { + var joinedValues = string.Join(";", values); + throw new InvalidProjectDataException(itemName, joinedValues, $"Item group '{itemName}' is required to specify a single value: '{joinedValues}'."); + } + else if (values.Length == 0) { - // TODO: Throw once we update integration tests to the latest VS (https://github.com/dotnet/roslyn/issues/65439) - // var joinedValues = string.Join(";", values); - // throw new InvalidProjectDataException(itemName, joinedValues, $"Item group '{itemName}' is required to specify a single value: '{joinedValues}'."); return null; }