title: How can I compile a .NET Standard 2.0 class library by directly invoking the C# complier using only the .NET Core SDK?
body: <p>When compiling a .NET Standard 2.0 class library project in Visual Studio 2019, the C# compiler (<code>csc.exe</code>) gets invoked to compile the project. If I examine the build log, the command line used looks something like this (line breaks added for readability):</p>
  
  <pre><code>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Roslyn\csc.exe
  /noconfig
  /unsafe-
  /checked-
  /nowarn:1701,1702,1701,1702,2008
  /nostdlib+
  /errorreport:prompt
  /warn:4
  /define:TRACE;DEBUG;NETSTANDARD;NETSTANDARD2_0
  /errorendlocation
  /preferreduilang:en-US
  
  &lt;
  A whole slew of /reference: switches that point to:
      %PROGRAMFILES%\dotnet\sdk\NuGetFallbackFolder\netstandard.library
      \2.0.3\build\netstandard2.0\ref
  &gt;
  
  /debug+
  /debug:portable
  /filealign:512
  /optimize-
  /out:obj\Debug\netstandard2.0\ClassLibrary1.dll
  /target:library
  /warnaserror-
  /utf8output
  /deterministic+
  Class1.cs
  /warnaserror+:NU1605
  </code></pre>
  
  <p>Now, assume that I am on a machine without any version of Visual Studio. Further assume that I have the .NET Core SDK unzipped into a directory on that machine. How can I recreate the above list of <code>/reference:</code> switches with the proper list of referenced assemblies? Where is the magic manifest that I can read that will let me assemble that list?</p>
  
  <p>The .csproj from which the above command line was generated has the following contents:</p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk"&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netstandard2.0&lt;/TargetFramework&gt;
    &lt;/PropertyGroup&gt;
  
  &lt;/Project&gt;
  </code></pre>
  
  <p>As one can see, there are no assembly reference tags in the project itself, so the list of references appears to be just the list of files located in the aforementioned directory. What I want to know is how that list of files was assembled to be placed in that directory for VS, and how to mimic it using only the .NET Core SDK.</p>
  
  <p>Please note that there are technical reasons I need to invoke the C# compiler directly; using MSBuild in any way is not an acceptable solution to this particular problem. This means that using <code>dotnet build</code> against a .csproj file is not an option for this particular project.</p>