diff --git a/src/Microsoft.Extensions.ProjectModel/Project.cs b/src/Microsoft.Extensions.ProjectModel/Project.cs index bf6afeade..5c7ea2172 100644 --- a/src/Microsoft.Extensions.ProjectModel/Project.cs +++ b/src/Microsoft.Extensions.ProjectModel/Project.cs @@ -17,7 +17,6 @@ namespace Microsoft.Extensions.ProjectModel // REVIEW: It's kinda hacky making these internal but the reader needs to set them internal Dictionary _targetFrameworks = new Dictionary(); - internal Dictionary _compilerOptionsByFramework = new Dictionary(); internal Dictionary _compilerOptionsByConfiguration = new Dictionary(StringComparer.OrdinalIgnoreCase); internal CompilerOptions _defaultCompilerOptions; @@ -186,13 +185,7 @@ namespace Microsoft.Extensions.ProjectModel private CompilerOptions GetCompilerOptions(NuGetFramework frameworkName) { - CompilerOptions options; - if (_compilerOptionsByFramework.TryGetValue(frameworkName, out options)) - { - return options; - } - - return null; + return GetTargetFramework(frameworkName)?.CompilerOptions; } } } diff --git a/src/Microsoft.Extensions.ProjectModel/ProjectReader.cs b/src/Microsoft.Extensions.ProjectModel/ProjectReader.cs index 77e75326c..b7961f7ac 100644 --- a/src/Microsoft.Extensions.ProjectModel/ProjectReader.cs +++ b/src/Microsoft.Extensions.ProjectModel/ProjectReader.cs @@ -417,7 +417,8 @@ namespace Microsoft.Extensions.ProjectModel var targetFrameworkInformation = new TargetFrameworkInformation { FrameworkName = frameworkName, - Dependencies = new List() + Dependencies = new List(), + CompilerOptions = compilerOptions }; var frameworkDependencies = new List(); @@ -449,7 +450,6 @@ namespace Microsoft.Extensions.ProjectModel targetFrameworkInformation.PdbPath = binNode.ValueAsString("pdb"); } - project._compilerOptionsByFramework[frameworkName] = compilerOptions; project._targetFrameworks[frameworkName] = targetFrameworkInformation; return true; diff --git a/src/Microsoft.Extensions.ProjectModel/TargetFrameworkInformation.cs b/src/Microsoft.Extensions.ProjectModel/TargetFrameworkInformation.cs index 26a731fcf..f240cd9b8 100644 --- a/src/Microsoft.Extensions.ProjectModel/TargetFrameworkInformation.cs +++ b/src/Microsoft.Extensions.ProjectModel/TargetFrameworkInformation.cs @@ -7,24 +7,19 @@ using NuGet.Frameworks; namespace Microsoft.Extensions.ProjectModel { - public class TargetFrameworkInformation : IFrameworkTargetable + public class TargetFrameworkInformation { public NuGetFramework FrameworkName { get; set; } public IReadOnlyList Dependencies { get; set; } + public CompilerOptions CompilerOptions { get; set; } + + // REVIEW: Wrapping, we might do this differntly public string WrappedProject { get; set; } public string AssemblyPath { get; set; } public string PdbPath { get; set; } - - public IEnumerable SupportedFrameworks - { - get - { - return new[] { FrameworkName }; - } - } } } \ No newline at end of file