How to add a define to an ASP.net solution?

心不动则不痛 提交于 2020-01-06 19:28:33

问题


i can add a define to a WinForms project through the Project Properties:

How do i add a define to an ASP.net solution?


Update: Here's what Visual Studio 2010 looks like when working in an ASP.net solution:


回答1:


Solution Explorer > WebApplicationProject (Name of your Web Application) > Properties > Build:




回答2:


Have you tried using the compilerOptions attribute of the compilerv element in web.config? Like so:

<system.codedom>
    <compilers>
        <compiler language="c#;cs;csharp" 
            extension=".cs" 
            warningLevel="4" 
            type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            compilerOptions="/define:TRACE">
            <providerOption name="CompilerVersion" value="v3.5"/>
            <providerOption name="WarnAsError" value="false"/>
        </compiler>
....

Should do the trick I think...



来源:https://stackoverflow.com/questions/11397158/how-to-add-a-define-to-an-asp-net-solution

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