From 1ae83eff708b5643a4b469b79adce9ede27b2341 Mon Sep 17 00:00:00 2001 From: Prafull Bhosale Date: Wed, 12 Oct 2016 09:49:12 -0700 Subject: [PATCH] Handle compilerOptions in project.json --- .../DotNetProjectContext.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.Extensions.ProjectModel.DotNet.Sources/DotNetProjectContext.cs b/src/Microsoft.Extensions.ProjectModel.DotNet.Sources/DotNetProjectContext.cs index fcacbd75f1..e038e6b42c 100644 --- a/src/Microsoft.Extensions.ProjectModel.DotNet.Sources/DotNetProjectContext.cs +++ b/src/Microsoft.Extensions.ProjectModel.DotNet.Sources/DotNetProjectContext.cs @@ -52,7 +52,7 @@ namespace Microsoft.Extensions.ProjectModel _compilerOptions = _projectContext.ProjectFile.GetCompilerOptions(TargetFramework, Configuration); // Workaround https://github.com/dotnet/cli/issues/3164 - IsClassLibrary = !(_compilerOptions.EmitEntryPoint + IsClassLibrary = !(_compilerOptions?.EmitEntryPoint ?? projectContext.ProjectFile.GetCompilerOptions(null, configuration).EmitEntryPoint.GetValueOrDefault()); _dependencyProvider = new Lazy(() => new DotNetDependencyProvider(_projectContext)); @@ -80,13 +80,17 @@ namespace Microsoft.Extensions.ProjectModel // TODO read from xproj if available public string RootNamespace => _projectContext.ProjectFile.Name; public string TargetDirectory => _paths.RuntimeOutputPath; - public string Platform => _compilerOptions.Platform; + public string Platform => _compilerOptions?.Platform; public IEnumerable CompilationItems - => _compilerOptions.CompileInclude.ResolveFiles(); + => (_compilerOptions?.CompileInclude == null) + ? _projectContext.ProjectFile.Files.SourceFiles + : _compilerOptions.CompileInclude.ResolveFiles(); public IEnumerable EmbededItems - => _compilerOptions.EmbedInclude.ResolveFiles(); + => (_compilerOptions?.EmbedInclude == null) + ? _projectContext.ProjectFile.Files.ResourceFiles.Keys + : _compilerOptions.EmbedInclude.ResolveFiles(); public IEnumerable PackageDependencies {