Question: Why am I not getting .css intellisense while coding the HTML in Durandal ~/App/Views/###.html pages.
Steps to Recreate:
In Visual Studio Professional 2012 I've began an "empty" ASP.NET Web Application and added Microsoft ASP.NET Web Optimization Framework 1.0.0 Nuget Package to my solution. I've also included Durandal 1.2.0 and Bootstrap 2.3.1.
After adding the above mentioned references to my application I've added a shell.html page to the ~/App/ folder that was generated when Nuget installed the Durandal package.
As a sidenote, the .css files are working fine once I debug the application. I have multiple .css files including the Bootstrap.css file (installed with Bootstrap 2.3.1 (mentioned above)) in my ~/Content/ folder and the ~/App_Start/BundleConfig.cs which are referencing and using the .css files as they should during runtime.
Lastly, when I go through the PluralSight Single Page Apps JumpStart tutorial and get to the Coding the Shell with Durandal.js section we see clearly that I'm/we're supposed to get intellisense, but I do not.
Thank you.
UPDATE:
I was just made aware "the issue has been routed to the Visual Studio Product Team for triage and resolution."
The CSS should work in VS 2012. I always install Web Essentials too, as it helps tremendously (its like an incubator for VS features between releases)
For the JavaScript intellisense ... when using require.js it is harder to get that. THe best way I found is to use Resharper's plugin for VS. It gives me intellisense on JavaScript, even when using require.js.
I solved the problem by adding an explicit bootstrap.css reference in the Site.Master (I am using master pages in my app)
<head runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%: Page.Title %> - My ASP.NET Application</title>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<webopt:bundlereference runat="server" path="~/Content/css" />
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link href="Content/bootstrap.css" rel="stylesheet" />
</head>
Related
The problem is that it fails to find any css files and thus the pages render horribly.
In the head section of my master page, I have the following line:
<webopt:bundlereference runat="server" path="~/Content/css" />
When I debug from the IDE and look at PageSource, the above translates to:
<link href="/Content/bootstrap.css" rel="stylesheet"/>
<link href="/Content/bootstrap-override.css" rel="stylesheet"/>
<link href="/Content/Site.css" rel="stylesheet"/>
When I point IIS to the project and run using localhost, I get no css applied and the PageSource translates to:
<link href="/QM/Content/bootstrap.css" rel="stylesheet"/>
<link href="/QM/Content/bootstrap-override.css" rel="stylesheet"/>
<link href="/QM/Content/Site.css" rel="stylesheet"/>
"QM" is the Alias I chose when I created the Application in IIS.
My question: Where is the "/QM" prefix coming from and how do I suppress it?
I'm sure I'm just missing something in my IIS setup or perhaps web.config, but I have been unable to find any help from previous questions or the web.
As is often the case, I was reading the symptoms wrong, misinterpreting what was important and not getting any help. Here's what I found:
First, I found that I could get the /QM prefix when running from the IDE as well by adding it in the Project URL on the Properties window of the Project. So that wasn't the problem at all.
What was wrong was that the IIS installation (Turn Windows features on or off) did not have Static Content installed so that even though the Handler Mappings had a handler for StaticFile (already there) it wasn't able to load because that part of IIS wasn't installed. Once it was, my page loaded as expected.
I have a WebForms site which is experiencing issues. Looking in Firebug, I can see that the following line in my master page:
<link rel="stylesheet" href='<%= ResolveClientUrl("/css/site.css") %>' />
is not "executing" on the server. Therefore, in Firebug I am getting:
http://www.mysite.com/Master_Pages/%3C%25=%20ResolveClientUrl(%22/css/site.css%22)%20%25%3E
when I would expect this to be
http://www.mysite.com/css/site.css
This has worked fine previously, and i've used this technique on other sites and never had a problem, but can't see why this has suddenly stopped working.
I've double checked and my head is set to runat=server:
<head runat="server">
so it should be executing on the server.
I've also tried changing it to:
<link rel="stylesheet" href=<%= ResolveClientUrl("/css/site.css") %> runat="server" />
Other things I've checked:
That the application pool and website are both targeting the correct and same instance of the .net framework
That the application pool has been recycled to ensure its clear
That I can hit break-points in my code behind
Can anyone suggest what may be causing this or what things I can check?
Thanks
Try this.
<link rel="stylesheet" type="text/css" href="css/site.css" />
This should work.
ResolveClientUrl("/css/site.css") should be ResolveClientUrl("~/css/site.css")
and also you omitted quotes around the value of attribute href.
I have asp.net app that I am trying to upload to azure host.
first I have try to link in the traditional way with Css folder and link to it
<link href="http://mysite.azurewebsites.net/css/style.css"
rel="stylesheet" type="text/css" />
NOT WORKING
then i create blob and reference to it :
<link href="http://mysite.blob.core.windows.net/scripts/style.css"
rel="stylesheet" type="text/css" />
NOT WORKING
now I dont get error but nothing happend to the styling (after empty my cache and restart the site)
I am not using master pages in my site just normal asp.net page.
i saw in some place that they are doing it with master page but there is other way to do it without master page.
Thanks.
Developing locally in Visual Studio 2010 my page looks great. When I deploy to the development server there is extra spacing and font size differences that mess things up.
Maybe it is because locally the Visual Studio rendering engine is iis7 vs on the development sever it is iis6.
How do I resolve this?
Thanks!!
Mark
You mean pages look different when viewed from the same browser? The only thing I can imagine is that you're missing some files (like CSS) when deploying.
That's probably got something to do with the IE Compatibility settings.
When you browse an intranet site; IE, by default, displays it in Compatibility View. So you may want to browse your application from different locations (local, internet, intranet) and check IE -> Tools -> Compatibility View Settings for the option "Display Intranet sites in Compatibility View". Turn it off and refresh to see if it works.
IIS got nothing to do with the page look and visual design.
You're probably viewing the page via the internal Visual Studio browser - don't do that.
Instead, right click the page and choose "View in browser" to open it with "real" browser like IE, FF or Chrome.
Try placing the link tag that references your css file out of your master page's contentPlaceHolder with id head as shown below,
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Title1</title>
<link href="~/css/layout.css" type="text/css" rel="stylesheet" media="all" runat="server" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
</body>
</html>
This fixed my issues while running through iis..
I have a Visual Studio 2008 .NET 3.5 Web forms project that constantly shows warnings for my class tags in the html. I have the CSS file included in the master page with the following link:
<link href="/Css/Site.css" rel="stylesheet" type="text/css" />
The warnings I get are:
The class or CssClass value is not defined.
At run time all is good and everything works as expected but these warnings in VS are getting very annoying. Is there some other way to have this linked in? I don't get any VS intellisense on the html class attributes and when I click the warning and then hover over the class="something" attribute on the html the warnings all disappear. Next time I build all the warnings come back.
Any ideas?
EDIT: The file is in include in the project. I have also tried changing the link to:
<link href="Css/Site.css" rel="stylesheet" type="text/css" />
This gives me intellisense it seems but I still have the warnings...
I have also tried:
<link href="~/Css/Site.css" rel="stylesheet" type="text/css" />
This is seeming to work...
Why would they all work at runtime but each one cause different behavior in VS?
EDIT: So closed and re-open VS, the ~ is still being used but warnings are all back and not going away. So is there anything else I can try? The master page is in the app root, the content pages are in sub directories.
Have you tried putting the "~" in your href...
<link href="~/Css/Site.css" rel="stylesheet" type="text/css" />
I've found that sometimes Visual Studio sometimes doesn't know how to map up the paths to the css file, depending on where the master file is and where the web content page is, so adding the ~ to the path helps the referencing to just start at the site root and move forward.
Figure it out. I was running Visual Studio 2008 RTM.
The css issue is a bug in RTM that is fixed in SP1.
Link to VS2008 SP1 Patch Notes
317251 - When you link to a .css file in a master page by using the ~/ syntax, child pages cannot access the .css file.
Is the css file in your visual studio project? I have had similar things happen when the css file is exists physically in the correct place on my machine, but is not referenced in the visual studio project.
If it is not, then adding it to the project should resolve the issue.