【问题标题】:How to enable checking for arithmetic overflow globally in the ASP.NET 5 | MVC 6?如何在 ASP.NET 5 中启用全局检查算术溢出MVC 6?
【发布时间】:2015-10-30 13:33:52
【问题描述】:

VS2013 MVC5项目中有一个设置:

可以打开

项目属性 -> 构建 -> 高级

但我在 VS2015 MVC6 项目中找不到类似的东西。

现在如何启用全局检查算术溢出?

【问题讨论】:

    标签: c# error-handling visual-studio-2015 settings asp.net-core-mvc


    【解决方案1】:

    在您的project.json 中,您可以设置compiler options。它可能可以从那里进行配置。我目前在我的工作电脑上(没有 asp.net 5),所以我无法验证它。我建议您使用 Intellisense 来查看它是否可用。

    {
        "configurations": {
            "Debug": {
                "compilationOptions": {
                    "define": ["DEBUG", "TRACE"]
                }
            },
            "Release": {
                "compilationOptions": {
                    "define": ["RELEASE", "TRACE"],
                    "optimize": true
                }
            }
        },
        "compilationOptions": {
            "define": ["SOMETHING"],
            "allowUnsafe": true,
            "warningsAsErrors" : true,
            "languageVersion": "experimental"
        }
    }
    

    更新 1

    目前编译选项似乎不支持它。如果你需要这个,我建议你在 github 上提出问题。

    来源:https://github.com/aspnet/dnx/blob/dev/src/Microsoft.Dnx.Runtime/Compilation/CompilerOptions.cs


    更新 2

    您可能想要扩展 this issue

    【讨论】:

    • 感谢您的回复。不幸的是,IntellySence 没有提供合适的选项。只有“allowUnsafe”、“define”、“delaySign”、“emitEntryPoint”、“keyFile”、“languageVersion”、“optimize”、“useOssSigning”、“warningAsErrors”。
    • 今晚有空的时候我可能会更深入地研究它,但如果智能感应说不......所有的赌注都没有了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-12-28
    • 1970-01-01
    • 2016-06-25
    • 1970-01-01
    • 1970-01-01
    • 2015-10-29
    • 1970-01-01
    相关资源
    最近更新 更多