Unsafe code compilation error in .NET Core even after setting allowunsafe flag to true in project.json
<p>I am using some unsafe code in my .NET Core app.
For that, I had made this change in the <strong>project.json</strong> file:</p>
<pre class="lang-json prettyprint-override"><code>&quot;compilationOptions&quot;: {
    &quot;allowUnsafe&quot;: true,
}
</code></pre>
<p>However, I still get the error <code>CS0227: Unsafe code may only appear if compiling with /unsafe</code>.</p>
<p>I had already gone through this:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/31295228/unsafe-code-wont-compile-on-visual-studio-2015">Unsafe code won&#39;t compile on Visual Studio 2015</a></li>
<li><a href="https://stackoverflow.com/questions/32211739/how-to-call-unsafe-code-from-asp-net-xproj">How to call unsafe code from ASP.NET xproj</a></li>
</ul>