在ASPX页面#调试preprocessor声明 [英] #DEBUG Preprocessor statements in ASPX page

查看:156
本文介绍了在ASPX页面#调试preprocessor声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ASPX页面使用preprocessor指令,但页面不承认它。这只是我不能做?

背景:我想包括在调试模式下的完整版本的jQuery(对,好,调试=)),以及缩小的版本发布。我想这一点,但我并不十分熟悉的ASPX<%语法。我只是从根本上误解这个语法做什么?

 <%#如果DEBUG%GT;
<脚本类型=文/ JavaScript的SRC =资源/ jQuery的-1.3.2.js/>
<%的#else%GT;
<脚本类型=文/ JavaScript的SRC =资源/ jQuery的-1.3.2.min.js/>
<%的#endif%GT;


解决方案

在这里有趣的差异 - 使用#如果在aspx页面DEBUG从web.config中的标签拉,但是当你在code使用-behind,它从从项目文件中生成配置的不断调试。因此,他们实际上是在访问两个不同设置。

因此​​,据我所知,这实际上不可能。

I'm trying to use a preprocessor directive in an ASPX page, but the page doesn't recognize it. Is this just something I can't do?

Background: I'm trying to include the full version of jQuery in DEBUG mode (for, well, debugging =) ), and the minified version for release. I tried this, but I'm not terribly familiar with the ASPX <% syntax. Am I just fundamentally misunderstanding what this syntax does?

<% #if DEBUG %>
<script type="text/javascript" src="resources/jquery-1.3.2.js" />
<% #else %>
<script type="text/javascript" src="resources/jquery-1.3.2.min.js" />
<% #endif %>

解决方案

Interesting difference here - using #if DEBUG in the aspx page pulls from the tag in the web.config, but when you use it in the code-behind, it pulls DEBUG from the constant from the build configuration in the project file. So they're actually accessing two different settings.

Thus, as far as I can tell, this isn't actually possible.

这篇关于在ASPX页面#调试preprocessor声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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