title: Roslyn Code Analysis returns false build errors from an error free solution
body: <p>I try to use Roslyn to analyze a very simple C# solution, a console application with a simple skeleton program:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace CA5
  {
      class Program
      {
          static void Main(string[] args)
          {
          }
      }
  }
  </code></pre>
  
  <p>The code above builds without any error in VS 2019 Preview.
  For such a simple solution/program I expected the Roslyn CA to work without any glitches, however the Roslyn compilation returns errors, most having to do with unrecognized type.</p>
  
  <p>My CA code is this:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using Microsoft.CodeAnalysis;
  using Microsoft.CodeAnalysis.MSBuild;
  
  namespace CA5X
  {
      class Program
      {
          static void Main(string[] args)
          {
              const string path = @"C:\Utils\CA5\CA5.sln";
  
              var props = new Dictionary&lt;string, string&gt;();
              props["CheckForSystemRuntimeDependency"] = "true";
              MSBuildWorkspace buildWorkspace = MSBuildWorkspace.Create(props);
  
              Solution solutionToAnalyze = buildWorkspace.OpenSolutionAsync(path).Result;
              foreach (Microsoft.CodeAnalysis.Project sProject in solutionToAnalyze.Projects)
              {
                  Compilation sCompilation = sProject.GetCompilationAsync().Result;
                  var errors = sCompilation.GetDiagnostics().Where(d =&gt; d.Severity == DiagnosticSeverity.Error); 
  
                  Console.WriteLine("COUNT:  " + errors.Count().ToString());
  
                  foreach (Microsoft.CodeAnalysis.Diagnostic diagnostic in errors)
                  {
                      Console.WriteLine(diagnostic.GetMessage());
                  }
  
              }
          }
      }
  }
  </code></pre>
  
  <p>The diagnostics retrieved after compilation are these:</p>
  
  <pre><code>The type or namespace name 'AssemblyTitleAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyTitle' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyDescriptionAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyDescription' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyConfigurationAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyConfiguration' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyCompanyAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyCompany' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyProductAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyProduct' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyCopyrightAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyCopyright' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyTrademarkAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyTrademark' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyCultureAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyCulture' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'ComVisibleAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'ComVisible' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'GuidAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'Guid' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyVersionAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyVersion' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyFileVersionAttribute' could not be found (are you missing a using directive or an assembly reference?)
  The type or namespace name 'AssemblyFileVersion' could not be found (are you missing a using directive or an assembly reference?)
  Predefined type 'System.String' is not defined or imported
  The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
  Predefined type 'System.Object' is not defined or imported
  Predefined type 'System.String' is not defined or imported
  Predefined type 'System.Void' is not defined or imported
  'object' does not contain a constructor that takes 0 arguments
  </code></pre>
  
  <p>I can only guess that this happens because of some configuration issue, but with so many .NET versions and so many VS versions is impossible to try all combinations. </p>