Prevent VS2010 CSS Validation from Reverting to CSS 2.1 - visual-studio-2010

I validate CSS in my new projects against CSS 3.0, thanks to the solution here:
VS2010, HTML 5 and CSS 3 Validation
However, every time I load the project, CSS validation reverts to 2.1 and has to be set through the toolbar to validate against 3.0 again.
Is there a way to make my selection sticky?

You can set it in Options -> Text Editor -> CSS Validation. I have taken the screenshot from VS2012. It is same in VS2010.

First, shut down VS2010
Assuming you're validating against html5 - the validation option is in
Text Editor-->HTML-->Validation
Set it to HTML5 validation. Then verify the following file exists:
< your install directory >\Microsoft Visual Studio
10.0\Common7\Packages\schemas\html\html_5.xsd
Copy the file elsewhere to be safe then edit the original file using a text editor. Near the top of the file find the string:
vs:cssschema="CSS 2.1"
and change it to:
vs:cssschema="CSS 3.0"
if it isn't already. Then save the file and restart VS2010. That should take care of making CSS 3.0 validation sticky against html5 projects

Related

VS 2022, I can't drag and drop css file into a cshtml file

I am working with VS2022 ASP.NET Core 6 MVC.
I tried to drag & drop one CSS file from explorer to a .cshtml file.
It should be made automatically like this code the same way-VS 2019
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
But prohibition icon shown when I am trying the drag & drop operation.
I started again VS 2022 with Administrator permissions, but it's still the same situation.
Any idea?
Drag & Drop is not yet supported in LSP-based editors. You can refer to this article:
https://developercommunity.visualstudio.com/t/cant-drag-javascript-or-css-files-onto-an-html-pag/1526177
There is a work around suggested by Microsoft: Tools-->Options-->Text Editor-->HTML-->Advanced-->Use Legacy Razor Editor for Asp.NET (Yes) -->OK
The work around that used was to add a temporary .html page to the project. Drag the controls to this page and cut and past them to the .chtml. It's just an extra step but it works.

How do I use a custom CSS stylesheet for Telerik?

I'm using Telerik grids, and want to customize the CSS. I've used Telerik's stylebuilder but I don't know what to do with it once I download the zip. Telerik says that I should
Simply add the files from this archive to your project, and your custom skin is ready go.
But I have no idea where in the project to add them, or even how exactly this is done. I moved the CSS files into the stylesheets folder (I'm using MS Visual Studio 2010) and linked to them, but no dice.
I've also read through this this and this but am still thoroughly confused.
Try the following:
Export theme from style builder, example classic.zip.
Contents of classic.zip
Folder: classic
File: telerik.classic.css
Extract zip to your project's content folder, c:\path to your project\Content\
Modify your master page style sheet regsitrar to include telerik.classic.css instead of the supplied style sheets.
:
<%= Html.Telerik().StyleSheetRegistrar()
.DefaultGroup(group => group.Add("telerik.common.css")
.Add("telerik.classic.css"))
%>

VS2010, HTML 5 and CSS 3 Validation

I want to switch CSS validation in VS2010 SP1 from CSS 2.1 to CSS 3.
I came across this answer:
Is it possible to change CSS Validation scheme in VS2010
What is not clear to me is how to activate CSS 3 validation. I did find that switching HTML validation to HTML 5 causes CSS to be validated as CSS 3 (after installing CSS 3 Intellisense Schema).
However, I would have thought that the HTML level and the CSS level would be orthogonal.
Am I missing something, or does the HTML validation switch truly also control the CSS validation level?
First, right click on the toolbar in VS2010 and enable 'Style Sheet'. Then once a CSS file is open and has focus you can change the target CSS validator from the drop down.

Can the VS "cascading style sheet version for validation" default be changed?

In reference to these related questions, I have had CSS3 validation set up in VS2010 for a while.
However each time I close a CSS file, the "cascading style sheet version for validation" dropdown in the css toolstrip changes back from CSS 3.0 to CSS 2.1. When reopening a css file, I need to reselect CSS 3.0 to avoid the validation errors.
Is there any way to change the default? Even a registry hack would be acceptable at this point, it really is quite annoying.
There is another benefit of changing the default for this, when editing a cshtml file. Without a CSS file open, the validation target dropdown is grayed out. So to change it to 3.0 you have to have a CSS file open. Another annoyance.
I checked Tools > Options > Text Editor > CSS, but there is no validation tab like there is for HTML.
Option 2 is to go into C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packages\1033\schemas\CSS and rename css30.xml to css21.xml (backup your files first of course).
That way, even though VS will show it is validating for version 2.1 it will really be validating for version 3.0

Why can't I add a XML datasource in Expression Blend 3?

I'm using Expression Blend 3
I click on "add live datasource", "add new xml datasource"
copy in a URL
but the OK button remains blank
adding a local XML datasource file works fine
How can I add a URL datasource in expression blend 3?
does this work for anyone else?
The problem is on every Expression Blend 3 I install on any computer, seems to simple be turned off in the beta.
alt text http://tanguay.info/web/external/blenddataokbutton.png
I just tried using blend 1.0. This version also had other options, such as 'infer xml schema'.
My guess is that there was some check added in later version to ensure that the file pointed to has an extension.
My suggestion is to edit the xaml directly. Note, this is old XAML from blend 1.0:
<Window.Resources>
<XmlDataProvider x:Key="rssDS" d:IsDataSource="True" Source="http://www.tanguay.info/web/rss/"/>
</Window.Resources>
Hope that helps, let me know.
I ran into the same problem when I tried to reimport a sample data from an XML file. The data source already exists or at least Blend thinks it still exists. You should see a warning if you mouse-over the Data Source Name textbox.
Delete the data source from the Data tab.
Delete the folder in the project view.
Rebuild the project.
If that doesn't clear it out, restart Blend.
That's what I had to do. I have Expression 4.0 Ultimate.

Resources