Question

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">
<html xmlns="http://www.w3.org/1999/xhtml">
<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 %>
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top