Unsafe code won't compile on Visual Studio 2015

半腔热情 提交于 2019-12-04 03:05:46

问题


I'm trying to compile a program on the new DNX4.6 core, but it won't compile due to:

error CS0227: Unsafe code may only appear if compiling with /unsafe

This is my code:

    [CompilerGenerated]
    public unsafe class GrayscaleQuantizer : PaletteQuantizer
    {
I've looked online, and I can't get any source with the same problem as I have. I can't tick the 'Allow Unsafe Code' at the Build tab of the Project Properties, because there is no option to do so...

Does anyone know a solution?


回答1:


You need to set "allowUnsafe": true in the build options in project.json.




回答2:


I wasn't smart enough to be able to figure it out with the help above. I did find that if you go to the solution explorer window and right click on properties, the one just above references, there will be an option to open. Click that one and then click on Build on the left. Allow unsafe code is on about the fifth line.



来源:https://stackoverflow.com/questions/31295228/unsafe-code-wont-compile-on-visual-studio-2015

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!