即使在project.json中将allowunsafe标志设置为true后,.Net Core中仍存在不安全的代码编译错误 [英] Unsafe Code Compilation error in .Net Core even after setting allowunsafe flag to true in project.json

查看:233
本文介绍了即使在project.json中将allowunsafe标志设置为true后,.Net Core中仍存在不安全的代码编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在.Net核心应用程序中使用了一些不安全的代码。
为此,我在project.json文件中进行了更改

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,
}

仍然出现此错误错误CS0227:不安全代码仅在编译时才会出现/ unsafe

我已经经历过了

不安全的代码无法在Visual Studio 2015上编译

如何调用不安全来自ASP.NET xproj的代码

推荐答案

更改 compilationOptions buildOptions

"buildOptions": {
    "allowUnsafe": true
}

这篇关于即使在project.json中将allowunsafe标志设置为true后,.Net Core中仍存在不安全的代码编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆