All you need to do is adjust the path to the CSS file in the <link href=""> attribute. The sample I supplied above is the proper syntax. Take note that using /Styles/Site.css will look for the Site.css file from the virtual root, and that using Styles/Site.css
will look for that path/file relative from the file you are using it in.
Make sure your style sheet's path is correct.by default all the style sheets placed under 'Styles' folder.alternatively you can choose the path where you saved .
I am sorry but I have just realized that my previous message must have been confusing. The error ""File not found: ../Styles/Site.css" was shown
only in the Manage Styles window.
The link, both previous and current version, has been working fine meaning the style sheet always works perfectly.
The issue is only with the Manage Styles window of VS.
I restarted VS, now the Manage styles widnows is completely empty. This makes me think that Manage Styles is not applicable to Razor files (i.e. .cshtml files). The Manage Styles window still works fine for .aspx files. It is only .cshtml files that have
the issue.
zipswich
Member
271 Points
434 Posts
Error: File not found @Href(
May 12, 2011 09:07 PM|LINK
I added a new ASP.NET Web Site (Razor) to a solution in VS2010. I believe the following code was created automatically by VS:
<link href="@Href("~/Styles/Site.css")" rel="stylesheet" />It works fine. However, the Manage Styles window shows the error "File not found @Href(" instead of the styles in Site.css.
Could you anyone offer some tip to get around this?
Thanks in advance.
LeroyGerrits
Member
501 Points
101 Posts
Re: Error: File not found @Href(
May 12, 2011 09:51 PM|LINK
zipswich
Member
271 Points
434 Posts
Re: Error: File not found @Href(
May 12, 2011 10:19 PM|LINK
Thanks for your response.
Now I get the error "File not found: ../Styles/Site.css" after following your suggestion.
LeroyGerrits
Member
501 Points
101 Posts
Re: Error: File not found @Href(
May 13, 2011 09:15 AM|LINK
All you need to do is adjust the path to the CSS file in the <link href=""> attribute. The sample I supplied above is the proper syntax. Take note that using /Styles/Site.css will look for the Site.css file from the virtual root, and that using Styles/Site.css will look for that path/file relative from the file you are using it in.
thenalimmu
Member
124 Points
74 Posts
Re: Error: File not found @Href(
May 13, 2011 09:27 AM|LINK
<
link href="Styles/Site.css" rel="Stylesheet" type="text/css" />Make sure your style sheet's path is correct.by default all the style sheets placed under 'Styles' folder.alternatively you can choose the path where you saved .
zipswich
Member
271 Points
434 Posts
Re: Error: File not found @Href(
May 13, 2011 12:38 PM|LINK
Hi all,
I am sorry but I have just realized that my previous message must have been confusing. The error ""File not found: ../Styles/Site.css" was shown only in the Manage Styles window.
The link, both previous and current version, has been working fine meaning the style sheet always works perfectly.
The issue is only with the Manage Styles window of VS.
I restarted VS, now the Manage styles widnows is completely empty. This makes me think that Manage Styles is not applicable to Razor files (i.e. .cshtml files). The Manage Styles window still works fine for .aspx files. It is only .cshtml files that have the issue.
suryamohan20
Member
163 Points
33 Posts
Re: Error: File not found @Href(
May 13, 2011 06:19 PM|LINK
Yes view-> Manage styels window is not working if we use @Href or @Url.Content to include css file but it is working fine if we use <link href=... />
-Surya.
zipswich
Member
271 Points
434 Posts
Re: Error: File not found @Href(
May 16, 2011 01:33 PM|LINK
In my case (VS2010 Ultimate), the Manage Styles window is still empty even if I use the following:
Again, I am using Razor and all files are cshtml.Zizhuoye Che...
All-Star
21915 Points
1915 Posts
Re: Error: File not found @Href(
May 17, 2011 04:01 AM|LINK
Hi,
According to your issue, you can have a look at these links.
http://msdn.microsoft.com/en-us/library/bb398931.aspx
http://msdn.microsoft.com/en-us/library/bb398979.aspx
http://www.codeproject.com/KB/TipsnTricks/DynamicCSSRazorEngine.aspx
Hope this can help you.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
zipswich
Member
271 Points
434 Posts
Re: Error: File not found @Href(
May 17, 2011 10:24 AM|LINK
Thanks for the links which have very useful information regarding css use.
Unfortunately they are not related to my issue - Manage Styles window not showing for cshtml pages.
At this point, I assume that the Manage Styles window of VS2010 does not support cshtml pages.