I am using some unsafe code in my .NET Core app. For that, I had made this change in the project.json file:
"compilationOptions": {
    "allowUnsafe": true,
}
However, I still get the error CS0227: Unsafe code may only appear if compiling with /unsafe.
I had already gone through this:
In the newer *.csproj files, this is now:
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
in any PropertyGroup.
NOTE:
This answer is based on earlier .Net Core/Standard project formats written in json. For the new formatted csproj see Ray's answer.
Change compilationOptions to buildOptions:
"buildOptions": {
    "allowUnsafe": true
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With