views:

433

answers:

1

Hi there,

I seem to be having an issue with the conditional compilation tags directly en my site.master..

basically i have the following but it reports "Cannot resolve symbol DEBUG" in the compiler alhough i can run in DEBUG and RELEASE ... but the final output always prints whats in DEBUG weather i am in RELEASE or DEBUG...

And as mentioned the compiler doesn't complain but it has little red lines under debug with the error msg.. What am i doing wrong? Can anyone help?

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head runat="server">
    <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>

    <% #if DEBUG %>
    <link href="../../Content/CSS/test.css" rel="stylesheet" type="text/css" />
   <script src="../../Content/Scripts/jquery-1.3.2.js" type="text/javascript">     
    </script>    
   <% #else %>
   <link href="../../Content/CSS/StyleSheetFinal.css" rel="stylesheet" type="text/css" />
   <script src="../../Content/Scripts/JavascriptFinal.js" type="text/javascript"></script>
   <% #endif %>
+1  A: 

I've never used the conditional compilation tags in aspx pages, but I have one idea on what might be wrong. When you say "run in DEBUG" or "run in RELEASE", exactly what do you mean? How are you setting it to debug or release mode? If you're just setting Visual Studio to do a debug/release build, that doesn't apply to how the aspx pages are compiled. Whether aspx pages are compiled in debug/release mode depends only on settings in the page header or settings in the web.config.

jthg
Thanks ... Ah, yes i was just compiling in DEBUG or RELEASE, which setting is this?? which part of web.config? I presumed compiling in release also compiles everything in RELEASE?
mark smith
Ahh i got it.. its working... so what does this actually mean.. all my dlls are compiled depending on Release/Debug when i compile but the web project is compiled depending on the web.config item??
mark smith
so there is a difference?
mark smith
Sorry I didn't check back sooner. Visual Studio only compiles all of the *.cs (or *.vb) files, so the setting in Visual Studio only applies to those. The *.aspx pages are compiled by the web server. The web server looks at configuration/system.web/compilation/@debug in the web.config to see whether it needs to compile in debug mode.
jthg