Introducing Pretty Paste for VS2012

Mar 24, 2013
Download Pretty Paste now! One of the things that have annoyed me about Visual Studio for many years, is the inconsistency when pasting code copied from websites. Depending on the browser you get different results. Consider the code snippet below copied from one of Sayed’s blog posts. If I copy that from Internet Explorer and paste it into Visual Studio, this is what I get: And copied from Chrome result in this: As you can see, both browsers include the line numbers, but they interpret them differently. Both browsers fail to understand my intent for copying the text and it has been that way forever. Very annoying. In tooling, understanding the user’s intent is the holy grail. So, in a rare moment of clarity a few days ago, I decided to fix this issue by writing an extension for Visual Studio - Pretty Paste. The idea is to inject some logic just before the regular Paste command in VS executes. That logic will quickly analyze the text being pasted and correct any non-intended line numbers and extra blank lines. With Pretty Paste, the result of pasting the above code sample now shows this: It automatically formats the code I pasted using the settings from each individual language. Here, my settings are set to use spaces instead of tabs and that is respected. In the case where you actually wanted the raw copied text instead of the cleaned up version provided by Pretty Paste, you can just undo the paste once to get the raw paste. Here’s the result of a Pretty Paste followed by an undo: This way we can have the best of both worlds. You decide. Nothing is lost. Pretty Paste is my 6th Visual Studio extension and I love that extensibility let’s me fix use cases that are important to me. The code is simple, short and sweet. Check it out on GitHub and fork away. Pull requests are more then welcome.* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

AngularJS Intellisense in Visual Studio 2012

Feb 19, 2013
Recently, a lot of people have asked for Intellisense support for AngularJS in the Visual Studio HTML editor. The bad news is that there is no extensibility for providing additional HTML attribute Intellisense, so I can’t ship this support in Web Essentials. The good news is that we can accomplish this through a more manual mechanism. Here’s what you need to do: Step 1 Find the file commonHTML5Types.xsd located in the Visual Studio install directory and back it up (just in case). Mine is here: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Packages\schemas\html Step 2 Download this new version of commonHTML5Types.xsd and replace the existing one from the directory in Step 1 with it. Step 3 Restart Visual Studio and that's it. You now have all the ng-* attributes available in Intellisense. This Works On My Machinetm, so please let me know if it works on yours too. I still want to add native support in either Visual Studio or Web Essentials, so if this is something you’re interested in, please vote for it here.* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Web Essentials nightly builds

Dec 2, 2012
Many Web Essentials users have requested a more formal process around nightly builds, that should result in a better delivery and update mechanism. To make it really easy to always run the latest and greatest, I’ve now created a custom feed for the Extensions and Updates dialog in Visual Studio 2012. Here’s how it works: Go to Tools > Options and open the the tab located under Environment –> Extensions and Updates. Click the Add button and type “Web Essentials Nightly” in the Name field and “http://vswebessentials.com/nightly/feed.ashx” in the URL field. Now click the Apply button and you’re all set. Now click the OK button to exit the Options dialog. Now the custom feed shows up in the Extensions dialog. Go to Tools > Extensions and Updates… to verify that the new feed is working. You should have a new sub category under the Online tab called “Web Essentials Nightly”. The Nightly build shares the same extension ID as the official released versions of Web Essentials, so the newest one will always override the one installed – regardless if it’s the nightly build or the official version. And updates will work normally. In other words, it should be perfectly safe to use this custom feed without any changes to how the update mechanism works from the user’s point of view. Only difference is that with this new feed, you can get the updates much faster than before. Give it a try and let me know what you think.* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Get latest CSS 3 support in Visual Studio 2010

Jun 3, 2012
Not everybody is able to upgrade to Visual Studio 2012 RC due to company policy or other reasons, but that doesn’t mean you can’t get some of its CSS 3 support in Visual Studio 2010 today. Whether or not you’ve got Web Standards Update installed or not, this is for you. We’ve been able to port some of the support from Visual Studio 2012 into a format that is understood by Visual Studio 2010, but a lot of it I’ve had to port manually. Before proceeding, you should know that this is completely unsupported and at your own risk. Here’s how to patch your installation of VS2010. 1. Download the new CSS 3 schema file 2. Locate the current CSS schema files. Mine are located at C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packages\1033\schemas\CSS. If you customized your install directory, then it’s located somewhere else, but the path should be similar. 3. If you have a file called css30.xml (from Web Standards Update), then replace it with the new downloaded file. If you don’t have css30.xml, then replace css21.xml with the downloaded file. I recommend you backup the old file before overriding it – just in case. 4. Restart Visual Studio 2010. Caveats Visual Studio 2010 doesn’t support some of the new CSS 3 constructs and unit types. This new schema file will not help with that. It can’t. What you do get is all the standard and vendor specific properties with Intellisense and validation to the degree Visual Studio 2010 supports it. Because a portion of this new schema was edited manually by me, it is possible that it contains a few bugs. Please report them in the comments if you find any, so I can get it fixed.* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Web Essentials - the idea

Nov 29, 2011
I’ve been pretty quiet about my latest extension for Visual Studio 2010 outside of Twitter, so I’m thinking it’s due time for a blog post about how and why Web Essentials came to be. If you don’t know what Web Essentials is or haven’t tried it yet, you might want to read Scott Hanselman’s blog post. Web Essentials was originally called CSS Essentials when it was first released in early 2011 because I wanted a name that clearly stated it was all about CSS. Years of web development had left me frustrated about the lack of attention CSS editors was getting by almost all IDEs, which in general only provided syntax highlighting, decent formatting and useless validation. Why did VB.NET and C# almost write itself when CSS was such a uphill battle with even the simplest tasks such as cross-browser rounded corners? That should be simple, right? Right?! I still considered myself a new employee at Microsoft at the time, with plenty of stuff to learn in my new role as Program Manager for the CSS and HTML editors in the Web Platform & Tools team. That’s why CSS Essentials remained dormant for the first many months providing little to no features. It wasn’t until September 2011 after the //BUILD conference, where we shipped the Visual Studio 11 Developer Preview that I revived the project with a few clear goals:Have fun writing code Live test features that we might consider including in Visual Studio Provide value to existing Visual Studio 2010 users Having fun Spare time projects have to be fun to survive. I learned that when I started BlogEngine.NET almost 5 years ago. Because it was so much fun adding new features to Web Essentials, I updated the extension almost daily. Some people really liked the frequent updates, but I got a lot of feedback from people who was so annoyed about it that they uninstalled it. That was no fun. Now I’ve slowed down the updates a bit and I still have fun. Live testing of features Some of the features are stolen inspired by Visual Studio 11 and some are unique to Web Essentials. Some of the shared features are implemented in different ways, but essentially solves the same problems. As a Program Manager for HTML, CSS and now also JavaScript, this is an ultimate way to get feedback on possible new features for Visual Studio. Please keep the feedback coming! Provide value to VS2010 users This is perhaps the most important part of the project. New versions of Visual Studio are usually 2-3 years apart and that’s a long time to wait for new features and general improvements. That’s also the reason why I released the Web Standards Update extension last June. Despite my role at Microsoft, Web Essentials is a completely private project. No Microsoft developer was hurt during the making of the extension. Scouts honor, boss! The reason I have for keeping it a private hobby project is that it gives me complete freedom to experiment with various features and improvements. It unfortunately also means that there is no QA other than myself. And you of course. Anyway, back to the story. After the project was revived I decided to change the name to Web Essentials because it reached broader while keeping focus on web development. Also, I wanted to add features to the HTML editor, such as drag ‘n drop of user controls, video and audio files. Something I had wanted for years as a web developer. The purpose now was to provide a broad set of improvements to make the experience writing client-side web code in Visual Studio better and more up-to-date. As of this writing, the extension is now on version 2.6 with 44.000+ downloads. That’s 16 releases in 2 months and it includes features for CSS, HTML, JavaScript and general web project features as well. The future of web development in Visual Studio, I think, has never looked better then with Visual Studio 11 on the horizon. Until then, Web Essentials will continue being updated and push the envelope on what Visual Studio 2010 is capable of. I would love to hear from you what sort of features, tweaks and improvements would make your life easier and more fun using the web tools in Visual Studio and Web Essentials. Most of the features in Web Essentials came from suggestions on Twitter and around the interwebs. So if you have a good idea, please share it.* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

CSS speed typing for Visual Studio

Nov 17, 2011
For the past few months, I’ve been looking at how to improve the web development experience in Visual Studio. This summer I released the Web Standards Update which brings HTML5 and CSS3 to Visual Studio, and a few weeks back Web Essentials was published. This week I’ve been working on a proof of concept that eliminates the need for typing curly braces, colons and semi-colons when working with CSS. In non-English keyboard layouts, these characters can be rather difficult to type, because you need to use SHIFT and ALT to get to them. Here is a quick demonstration of how to write CSS without the need for these characters. I’ve been using this for about a day now on an English keyboard and I am so much more productive writing CSS. What I’m really interested in though, is whether or not YOU are when using this extension. Also, is it annoying, in your way, a waste of time, or the best thing EVAR!! Please try it out and let me know. I’d appreciate any feedback on this. Thank you! Try it today! Download the SpeedTyping extension for Visual Studio 2010 and let me know what you think on Twitter Who knows, we might add this to the next version of Visual Studio…* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

HTML5 & CSS3 in Visual Studio 2010 SP1

Jan 27, 2011
Since the release of Visual Studio 2010 SP1 beta last month, there has been a lot of questions regarding the support for HTML5 and CSS3. HTML5 Visual Studio 2010 was originally released without HTML5 support, so does SP1 finally add support for it? Yes, to some extent. The entire HTML5 specification isn’t supported but most of the new elements and attributes are. That means you get both intellisense and validation for HTML5 with SP1. Turn it on After installing SP1 you have to tell Visual Studio to start using the HTML5 schema. Go to Tools -> Options, and then select Text Editor -> HTML -> Validation. You should now be able to select HTML5 or XHTML5 as the target schema. Or if you have the HTML Source Editing toolbar enabled, you can select it in the target schema dropdown. Intellisense support The new elements that are specific to HTML5 are shown in the intellisense list as you would expect. Even the new HTML5 specific attribute values for existing elements are shown. Prior to SP1 there had been a bug that caused a runtime error when an input element used some of the new type attribute values such as email in conjunction with runat=”server”. <input type="email" runat="server" />This error has been fixed and will be included in the final SP1. However, it is not part of SP1 beta. In the meantime, you can use the Textbox control instead which doesn’t cause the error. <asp:textbox type="email" runat="server" />CSS3 In SP1 there are a few improvements in the CSS3 support as well, though not as elaborate as with HTML5. The editor now supports the more advanced selectors such as div:nth-child(2n+1) without giving validation errors and the new color values rgba, hsl, hsla and 8 digit hex values are also supported. Start today The conclusion is that with Visual Studio today, you can build HTML5 and CSS3 web applications on top of ASP.NET, and with SP1 we are making it a lot easier for you. We encourage all ASP.NET developers to start taking advantage of what HTML5 and CSS3 has to offer already today. The Web Platform and Tools team takes web standards very seriously and you will see much better support for HTML5 and CSS3 in the future.* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Print Visual Studio project

May 22, 2007
Things that the users would expect to find in an application should always be there. [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Web Application Projects vs. Web Site Projects

May 8, 2007
When Visual Studio 2005 was released together with ASP.NET 2.0, the web project model was totally changed from the ASP.NET 1.x model. It took some time for me to get used to it, and in the beginning I didn’t like it much. Apparently, I was not alone and Microsoft got a lot of mail from developers who wanted the old Web Application Project (WAP) model back. Visual Studio 2005 Service Pack 1 then reintroduced the WAP model. I never really understood why so many people wanted the old model back, because it has some serious inconveniences. My guess is that almost all of the people who wrote Microsoft wasn’t web developers to begin with, but maybe had a past doing Windows Forms to which the WAP model bares many similarities. No change 'n review Old school web developers like to make a small change and then see how it looks and continue to do so an awful lot of times. The WAP model doesn’t allow you to do quick changes and review them at once. You first have to compile the entire project and that can easily take 30 seconds for larger web projects. At work, we have a web project that takes 3 minutes to build. That quickly gets very annoying and is just a waste of time. The Web Site model does not have that problem. No quick ‘n dirty editing In the WAP model, if you don’t have Visual Studio you cannot change anything but the layout and that is really annoying. When I’m away from my Visual Studio and finds something I want to change, then I’m not able to. The Web Site model on the other hand allows me to change anything I want using only Notepad and the build-in FTP capabilities of IE. Annoying deployment The initial deployment in the WAP model is easier because there are fewer files to be FTP’ed to the remote location. But if you want to make a small change and deploy it, then you have to FTP the dll file which can be several hundred kilobytes. Now you think: how can that be a problem on your super broadband connection? Well, it can if I’m doing small changes an awful lot of times and need to upload them to review them. Then that extra 5 seconds of upload time just get on my nerves. In the Web Site model you just upload the file you changed. That’s 2 kilobytes versus 200 kilobytes. What I’m trying to say is, that I don’t understand the popularity of the WAP model…* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

Debug JavaScript in Visual Studio 2005

May 5, 2007
Explains how to enable debugging of JavaScript in Visual Studio [More]* $4.95/month ASP.NET Hosting with FREE SQL 2012 DB! – Click Here!

About the author

Mads Kristensen

Mads Kristensen
Program Manager at the Microsoft Web Platform team and founder of BlogEngine.NET.

More...

Month List

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer’s view in any way.