我在 .NET Core 应用程序中使用了一些不安全的代码。
为此,我在项目.json file:
"compilationOptions": {
"allowUnsafe": true,
}
但是,我仍然收到错误CS0227: Unsafe code may only appear if compiling with /unsafe
.
我已经经历过这个:
- 不安全的代码无法在 Visual Studio 2015 上编译 https://stackoverflow.com/questions/31295228/unsafe-code-wont-compile-on-visual-studio-2015
- 如何从 ASP.NET xproj 调用不安全代码 https://stackoverflow.com/questions/32211739/how-to-call-unsafe-code-from-asp-net-xproj
在较新的*.csproj
文件,现在是:
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
in any PropertyGroup
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)