Visual Studio (2012 and lower) deletes CSS propert

2019-01-14 06:35发布

I have a really strange problem with Visual Studio 2010. When I add CSS properties for a gradient to my stylesheet, Visual Studio is going to delete it after some times of debugging.

Example of the code I add to my stylesheet:

.button
{
    /* Firefox */
    background-image: -moz-linear-gradient(top, #fff, #efefef);
    /* Chrome, Safari */
    background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #fff),color-stop(1, #efefef));
    /* Modern Browsers*/
    background-image: linear-gradient(top, #fff, #efefef);
    /* IE */
    filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#efefef'); 
}

Sometimes when I start debug, Visual Studio edits the CSS:

.button
{
    /* Firefox */
    background-image: linear-gradient(top, #fff, #efefef);
    /* Chrome, Safari */
    /* Modern Browsers*/
    }

So Visual Studio seems to delete some attributes it doesn't know. That's really annoying. Any idea how I could stop that?

It's not a problem of CSS comments. It also happen without the comments.

Update

It seems that it happens by saving of files that included the css file. When I edit my Master Layout and save it, Visual Studio is gonna delete this properties I mentioned above in the linked css file.

And its NOT a CSS3 problem because it doesn't touch my border-radius classes and ids. So maybe it's the filter property. However I want stop Visual Studio changing my things in the css file without permissions.

Update 27. June 2014

Problem solved in Visual Studio 2013 https://connect.microsoft.com/VisualStudio/feedback/details/782677/visual-studio-is-deleting-css

7条回答
仙女界的扛把子
2楼-- · 2019-01-14 06:45

In Visual Studio try: Tools > Options > Text Editor > CSS > Miscellaneous switch off Detect Errors. I did this and using a file with your sample above, ran the solution, closed the file, closed the solution and my code is still there :-)

查看更多
登录 后发表回答