title: Reference netstandard Nuget Package in 4.7.2 Project Mono
body: <p>I am trying to reference a .net standard Nuget package in my .Net 4.7.2 Project in Mono. The build works fine in Windows, however under Ubuntu 18.04, I get the following error when using an Attribute from the library.</p>
  
  <pre><code>  DataClassThing.cs(7, 10): [CS0012] The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
  </code></pre>
  
  <p>I've followed that instruction and installed the following nuget package: </p>
  
  <p><code>&lt;package id="NETStandard.Library" version="2.0.3" targetFramework="net472" /&gt;</code></p>
  
  <p>I've also tried:</p>
  
  <p><code>&lt;package id="NETStandard.Library" version="2.0.0" targetFramework="net472" /&gt;</code></p>
  
  <p>But the error persists.</p>
  
  <p>The full Nuget packages.config generated by nuget looks as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;packages&gt;
    &lt;package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net472" /&gt;
    &lt;package id="MyMagicLibrary" version="1.0.25" /&gt;
    &lt;package id="NETStandard.Library" version="2.0.3" targetFramework="net472" /&gt;
  &lt;/packages&gt;
  </code></pre>
  
  <p><code>MyMagicLibrary</code> is from a private Nuget feed and only targets .net standard 2.0.</p>
  
  <p>The Netstandard Library seems to install correctly, adding build targets to my csproj file in the following section:</p>
  
  <pre><code>&lt;Import Project="..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" /&gt;
    &lt;Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"&gt;
      &lt;PropertyGroup&gt;
        &lt;ErrorText&gt;This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.&lt;/ErrorText&gt;
      &lt;/PropertyGroup&gt;
      &lt;Error Condition="!Exists('..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets'))" /&gt;
      &lt;Error Condition="!Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets'))" /&gt;
    &lt;/Target&gt;
    &lt;Import Project="..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" /&gt;
  </code></pre>
  
  <p>I checked and all the files are there as expected.</p>
  
  <p>This is my mono version:</p>
  
  <p><code>Mono JIT compiler version 5.18.0.209 (tarball Sat Nov 24 08:46:26 UTC 2018)</code></p>
  
  <p>Installed from 5.18.0 Preview (5.18.0.209) (<a href="https://www.mono-project.com/download/preview/" rel="nofollow noreferrer">https://www.mono-project.com/download/preview/</a>)</p>
  
  <h3>Update</h3>
  
  <p>I tried adding</p>
  
  <pre><code>  &lt;ItemGroup&gt;
      &lt;Reference Include="netstandard"/&gt;
    &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>To my csproj file, which resulted in the following error:</p>
  
  <pre><code>Target ResolveAssemblyReferences:
      Primary reference "netstandard".
      /usr/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(2127,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "netstandard". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
              For SearchPath "{TargetFrameworkDirectory}".
              Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.7.2/netstandard.winmd", but it didn't exist.
              Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.7.2/netstandard.dll", but it didn't exist.
              Considered "/usr/lib/mono/xbuild-frameworks/.NETFramework/v4.7.2/netstandard.exe", but it didn't exist.
              For SearchPath "{GAC}".
              Considered "netstandard", which was not found in the GAC.
              For SearchPath "{RawFileName}".
              Considered treating "netstandard" as a file name, but it didn't exist.
              For SearchPath "bin/Debug/".
              Considered "bin/Debug/netstandard.winmd", but it didn't exist.
              Considered "bin/Debug/netstandard.dll", but it didn't exist.
              Considered "bin/Debug/netstandard.exe", but it didn't exist.
  </code></pre>