问题
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,
}
Still this error comes error CS0227: Unsafe code may only appear if compiling with /unsafe
I had already gone through this already
Unsafe code won't compile on Visual Studio 2015
How to call unsafe code from ASP.NET xproj
回答1:
Change compilationOptions
to buildOptions
:
"buildOptions": {
"allowUnsafe": true
}
回答2:
In the newer *.csproj
files, this is now:
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
in any PropertyGroup
.
来源:https://stackoverflow.com/questions/39256383/unsafe-code-compilation-error-in-net-core-even-after-setting-allowunsafe-flag-t