If are using the great Web Essentials Visual Studio extension, and you updated the extension yesterday and noticed in Web Essentials change log that several editors like LESS and CoffeeScript editors were removed, this was as the editors moved into the official update.
This means if you want to use the recent update with Web Essentials (strongly recommended), you probably should also update Web Essentials to the latest version first before installing the update (Scott mentions that as well).
Notes On Installing Resharper 6.1 Nightly Build For VS11
The file you download is not an EXE, but it is still an installer. All You need to do is run the file and press "Install"
You can use the license key mentioned in the download page, but, you may try your existing Resharper 6.0 key as well and see if it works.
Likely the Resharper keyboard shortcuts won’t work directly. You need to enable them yourself. More on that below…
UPDATE: If you install a nightly build, then a new build comes out and you try to install it, you get "This extension is already installed to all applicable products.". More on that below…
To enable the Resharper keyboard shortcuts:
In Visual Studio 11, go to Resharper Options menu:
In the left side, choose "Visual Studio Integration"
Under "Keyboard Shortcuts", press "Apply Scheme"
Some quick dialog will show with "Cancel" button (don’t press it!). Wait until it disappear, and you are done. Click OK to close the Options dialog, and start enjoying the Resharper shortcuts!
To Solve: "This extension is already installed to all applicable products." Error
If you try to install the Resharper VSIX installer file for VS11 when you have an earlier Resharper VS11 build, you may get an error that looks like:
Visual Studio thinks the two builds are the same. The likely cause is that Resharper is using the same version number in the installer.
This can be easily fixed by opening VS 11, going to Tools -> Extension Manager, finding the Resharper extension (yes, in VS11 it’ll be there, in earlier VS version, it won’t), click the Resharper extension in there then click "Uninstall", accept the confirmation, and close VS11 afterwards.
It’s been quite sometime since I first installed VS 11 (soon after dev preview came way), so, I thought I’d share my experience around using it as primary IDE (with VS 2010 solutions most of the time):
It works nicely with Visual Studio 2010 solutions, even big real-world ones. It doesn’t convert them but does some changes to project files which are backwards compatible (mainly minor formatting changes). Note that from the source-control point of view, those are still changes.
Somehow all my IIS 7.5 application pools lost their "Enable 32-bit applications" option very shortly after that. This is too coincidental with Visual Studio 11, although I’m not 100% sure if it was the reason. It could be hard to debug, If you start getting errors like "unable to load assembly <some path>.dll. or one of its dependencies. An attempt was made to load a program with an incorrect format.". Check for that option.
It works a bit faster than Visual Studio 2010. Maybe because it has fewer plug-ins, but I think if I remember bare-bones Visual Studio 2010 correctly, this Visual Studio 11 one is still (slightly) faster.
Not much difference in editor for C#, but nicely improved editor for JS / CSS
The real differently looking was the team explorer & TFS features in general – mixed feelings about it
Not sure I like how Pending Changes is not a separate window anyone. I have to change the Active View to Work Items to find the query I want, click it, go back to Pending Changes, and then drage the work item I want to associate with changeset
The changed files show in folder hierarchy. You have two completely separate hierarchies for “Included” and “Excluded” files in/from the changeset. Makes it easier to avoid “checked-in this file by mistake” errors.
When comparing files, finally you get coloring (nice one), one of the modes is combined view (they still have 2, and 3 pane views), which does support live editing. It’s not just text editing experience you get in some merge tools. It’s context-aware full VS editor experience. Things like intellisence, Go To Declaration, Find Usage, Refactor, etc.. and context menu options including those added by third-party tools like TestDriven.NET are available. . I found myself editing files in combined-compare view a lot and it makes it great seeing exactly what I’m changing
Yesterday I wrote about how to get old style add-ins (showing in Tools-> Add-ins Manager) to run in Visual Studio 11, demonstrated with Test Driven .NET.
Today I write about getting Visual Studio Gallery extensions (showing in Tools->Extensions Manager) to work with Visual Studio 11, demonstrated with Git Source Control Provider.
The two posts depend on minor changes to the Visual Studio 2010 versions of the plug-ins.
Visual Studio Extensions Gallery
When you run Tools->Extensions Manager in Visual Studio, it looks at Visual Studio Gallery feed and reads what’s in it. When you choose to install an extension, you download a ".vsix" file, that contains all the files of the extensions and then run it.
So, to get an extension to work with Visual Studio 11, go to the Visual Studio Gallery website to download the extension ourselves.
After download, we get the "GitSccProvider.vsix" file. Rename that to "GitSccProvider.zip", and extract it to some folder, say "GitSccProvider" (some compression programs allow you to do this without renaming. I’m here using Windows default tools).
It should look like this:
Right click "extension.vsixmanifest" and choose Open With->Notepad
It should look like (highlight is mine):
We need to do 2 things.
First, change MaxVersion (highlighted above) from "4.0" to "4.5".
Second, under <SupportedProducts>, before the opening of <VisualStudio Version="10.0">.
Save the file, select all the files in the folder (do "not" go up and select the folder itself), right click the selection, and choose Send To-> Compressed (zipped) file.
By default, this creates a new "GitSccProvider.zip" file in the same folder,. Rename that file to "GitSccProvider.vsix" (accept Windows warning, say yes!).
Run the "GitSccProvider.vsix". It may take a short while to open, but then you should see something like:
(Note, you won’t see Visual Studio 2010 option if you have the extension installed in it already)
Now, proceed with "Install", after it’s done, close it, and run a new instance of Visual Studio.
You should be able to find it installed under Tools-> Extension Manager:
That’s it. Use the same concept for other extensions in the gallery (read the warning at the end of the post though).
Notes About Git Source Control Provider
Because this specific extension is a source control provider, to use it, you need to go to Tools->Options->Source Control and explicitly choose to use it. This is not the case for non source control provider plug-ins (i.e. not the case for the very vast majority of extensions).
Warning: Running Doesn’t Mean Working
The first extension I got running in VS 11 was Visual Studio Color Themes Editor. It got its menu in, and I can choose colour palettes and everything, but here is what I get if I choose anything other than "Default" palette:
Not very pleasant, ha?
Basically, this is a hack. It may work nicely like the one demoed here,, and it may not. The difference in Visual Studio is not just version number. There must be a lot of internal design and APIs and such that may affect how the plug-ins work.
I have been using Visual Studio 11 as primary IDE instead of Visual Studio 2010 at work all day. Details of that might come in a later post, for now, this is on a specific problem. Getting TestDriven.NET to work with Visual Studio 11.
The current project uses MbUnit for number of Selenium functional tests locally and on CI servers. We used to run those using Resharper 5.x in Visual Studio 2010. When Resharper 6 came out, the Gallio / MbUnit Resharper plug-in that made running those tests possible was not compatible with it (and still is not to the date of this post), so, we used TestDriven.NET instead.
When Visual Studio 11 Developer Preview came out,, all installed plug-ins didn’t work with it.
Plugins are two types:
Visual Studio Extensions: Downloaded from Visual Studio Gallery usually,, which is browsable from the IDE Tools-> Extensions Manager menu
Old Style Addins: Usually have their custom installers, which basically drop a ".addin" file (which describes the add-in to Visual Studio) along with the DLLs that make the plug-in. The default location is My DocumentsVisual Studio 2010<or 11 for the preview>Addins. Sometimes, addins are in other locations as well.
TestDriven.NET comes under the 2nd category.
Test Driven .NET With Visual Studio 11
To get the TestDriven.NET plug-in working with Visual Studio 11, we need we first need to get the location of the TestDriven.NET installation. For me the path was C:Program Files (x86)TestDriven.NET 3.
Go to this folder, you should find a file named "TestDriven2010.AddIn". Make a copy of this file, and rename the copy to "TestDriven11.AddIn".
Run Notepad as administrator (Right click it and choose "Run as administrator"),
Click File->Open, and browse to the "TestDriven11.AddIn" file (You’ll need to choose "All files" from the file type drop down).
The file should look like that:
Change <Version>10.0</Version> to <Version>11.0</Version>.
Save the file, and close this.
Next step, we need to get Visual Studio 11 to recognize this file. The easiest way is to add the TestDriven.NET folder to the paths that Visual Studio looks searches for addins.
To do this, open Visual Studio 11, Go to Tools->Options, then from the left tree view, browse to Environment->Add-in Security
Click, Add, and enter the folder of TestDriven.NET installation on your machine, where the .addIn files were found, and press OK
You should be able to see the folder down the list, and press OK to save the change.
You may get a messaging saying you need to restart Visual Studio for the changes to take place.
Restart Visual Studio, then go to Tools->Add-in Manager. You’ll find TestDriven.NET in there, make sure it’s enabled (or enable it by ticking the check-boxes) as below:
Now, your Test Driven.NET addin should work nicely.
Remember, you can apply the same to any .AddIn Visual Studio plug-in.
It has a nice feature.. Copy code as html. The feature doesn’t add any new menu option or whatever, simply when you copy the code the usual CTRL+C or Edit -> Copy way in Visual Studio, and paste it in a text-only editor like Notepad, it’ll be treated as text normally, but if you paste it in an HTML capable editor like Microsoft Word, it’ll be paste as HTML.
If you already know what the feature is, and have a problem with Live Writer 2011 or similar version, you can skip to the title that mentions it.
If you wonder how made this rectangular selection, you can do it by pressing ALT before selection and holding as you move the mouse to continue to select
If you wonder why, simply to avoid the spaces on the left in the pasted code
If I paste this in notepad, nothing new!
But if I paste in Word 2010 (Outlook is the same)
(it can be better if play with font size and text wrapping options)
Or in Visual Studio HTML Designer
If I paste in source view or any other code-editor view in Visual Studio, it WILL not paste as HTML but as normal text. This is intended, because when you do copy / paste inside Visual Studio, you want it to just work, not have to clean all generated HTML
This is related to the way this feature works. In Windows, you can have multiple formats of copied stuff in clipboard. Text and HTML are two of these formats. So, the feature is simply adding HTML format option to the clipboard, and Visual Studio built-in functionality of course adds the text format already.
Windows Live Writer
Obviously Windows Live Writer is an HTML editor for blog posts, among other features. And I bet it is as obvious that the most common use of this Copy HTML feature is to embed in your blog posts.
Putting code in blog posts this way has its own disadvantages and disadvantages. Those, along with whether you should use this approach or not, are beyond the scope of this post.
You go enthusiast to Live Writer to give it a try, you press CTRL + SHIFT + V, ALT + K. But you may encounter the same other problem as me, it doesn’t work, at all, at least in my Windows Live Writer 2011.
Well, after looking for the the "Paste Special" feature in Windows Live Writer, it was very close to me, in the context menu (right click inside text editor)
When clicked, we get the dialog in the official announcement, by default it selects the 2nd option, but we should select the 3rd, "Keep Formatting"
And here we go…
Works as advertised!
Copy HTML Visual Studio Productivity Power Tools Feature Settings
Let’s look at the code we got inside Windows Live Writer (it doesn’t matter which application I guess)…
As you can see, this is really ugly code, so many <span> tags with inline styles, and even <font> tags (thought no-body uses them anyway) and so on.
You can argue this is normal in this way of adding code to blog. You can argue this is why you should ignore this way completely. I’d ask you to have this discussion in the great post Scott HAnselman wrote about this and other approach in this case, but assuming we continue with this one, let’s see what we can and what we cannot improve here…
In Visual Studio, Go To Tools -> Options, from the right side tree, navigate to Productivity Power Tools -> HTML Copy:
The first two options are like header / footer of the code. Those are the opening and closing tags of the generated HTML code. You can change them as you like, for example, for me, I’d add <code> tag around those since I have some extra CSS applied to this tag boxing style ad want my snippets to take it.
The emit spam class will not use CSS styles if you sett to true, instead, will use certain CSS classes. Do not select it unless you know what the CSS classes are and have their styles. Also, if you add those styles to the blog CSS, it won’t show in RSS readers, and if you put in each post, it just feels wrong – again choice is yours after you read Scott’s post.
The emit spam style is what created us the inline CSS. This is the default and unless you care about minimizing the noise you’ll be interested in trying the previous option and disable this one.
You’ll want to enable the two if you are testing to see what inline styles will apply to <span> tags with which CSS classes.
The option to replace line-breaks (new lines) with <BR> is something you normally won’t set to true. You can see the default surrounding tags include <pre>, and <pre> tag in HTML reserves spaces and line breaks, unlike other HTML tags.
If you keep the line breaks and the <pre> tags, the code will be displayed properly in your blog, and when someone tries to copy it to their code editor (Which understands text only, even Visual Studio source/code editor as mentioned above) the line breaks will work correctly, but if you use <BR>, the text editor will not see them (As this is HTML not text) and will render multiple lines in only one, and the poor reader will need to add the line breaks on his own.
The last option is what letter or code is used for space s(Assuming even tabs will convert to spaces).By default it uses the HTML code for spaces . If you are keeping the <pre> tag in your generated HTML, you can replace this with normal real SPACE letter (just replace the value in text box with one press on the space-bar in your keyboard). Since I recommend keeping the <pre> tag anyway, I recommend you use spaces directly too.
I noticed that with different plugins and options to render code in blog with Windows Live Writer, it quite affects the stability of the application. You can see it easily crashing when you move between Edit/Preview/Source views.
Windows Live Writer has a nice recovery feature that usually work (sometimes insists on offering to recover what I recovered already. but that’s fine). However, you should also save yourself a piece of mind and press CTRL + S every now and then and specially before switching views. I press it all the time like crazy every line or less!
BTW, this is how the code looks for me on THIS blog:
If you don’t know what is NuGet, please skip to the end first
For some time NHibernate 3.0 package on Nuget was listed as owned by Fabio Maulo (@fabiomaulo), a main comitter to NHibernate, but was not owned by him until NHibernate 3.1 came out and there was a need to upgrade the package, which happened today.
You can find NHibernate package on Nuget by searching for the word NHibernate in the gallery, or going to the package page directly on :
However, in this page (or summary pane in Nuget tool in Visual Studio when you select the package, you’ll read:
DONT INSTALL IT DIRECTLY Only as reference for others frameworks. NHibernate is a mature, open source object-relational mapper for the .NET framework. It’s actively developed , fully featured and used in thousands of successful projects.
Why Is That?
The reason for that is that NHibernate requires using something called a proxy factory. This is the tool that creates proxies of your entities (usually in runtime) for things like Lazy Loading to work. NHibernate has built-in support for those proxy factories, Castle Dynamic Proxy, .LinFu Dynamic Proxy, Spring AOP Framework.
So, What Should I Install ?
What you should actually do is to choose whether you want to use the Castle, LinFu, or Spring proxies, and based on that, install one (and –typically- only one) of the following packages:
Those packages all created by Fabio as well and depend on the main package. I will not give any differentiation between them and/or when to use them, but maybe if you use FluentNHibernate, you’ll want to use Castle Dynamic Proxy as this is their default.
FluentNHibernate/ConfORM & Other Libraries Depending on NHibernate
The way NHibernate package works from now on will make it a bit confusing to get other packages. For example, if you want to get FluentNHibernate / ConfORM, you will find that it explicitly depends on NHibernate package, but in the same time you are likely to need to install any of the other proxy-specific packages which is not set in the package dependencies.
The creator of FluentNHibernate may decide to depend on a proxy specific package instead, but this will be a problem if another NHibernate-dependent library may decide to depend on another proxy-specific package and it becomes a mess. So, I guess library creators will better not do that and we’ll need to live with the non-explicit dependency that is still likely required.
There is a really nice article on how to install for how to install NHibernate 3.0, and Windsor both from NuGet on ASP.NET MVC projects, The same rules though apply to NHibernate 3.1 and other types of projects than ASP.NET MVC.’
Other than that, there is something you need to be careful of, assembly versions:
Installing Libraries That Depend on Specific Earlier Version of NHibernate|
Let’s take FluentNHibernate a an obvious example. FluentNHibernate package on NuGet is set to depend on a pre-release version of NHibernate 3.0. Not much changed in the FluentNHibernate library since then that will make you worry, so, to install it you need to do the following:
Install one of the proxy packages, preferably NHibernate.Castle since this is the default in FluentNHibernate
Install FluentNHibernate (don’t install it first so that it doesn’t just install old version of NH package as dependency)
Apply Assembly Binding Redirect (see below)
Assembly Binding Redirect
Assembly Redirect is a way in .NET that you can use if you reference an assembly with specific version , and you want to use a different version of this assembly without recompiling your code or anything, you can tell .NET to redirect any request for the old version of the assembly to the new one. This is exactly what FluentNHibernate and any library that references specific old version of NHibernate need to do.
God news is, NuGet can setup the correct assembly redirects for you. In the current version of NuGet you need to explicitly call this functionality though. Next version of NuGet will run it automatically when you install a package.
Here is how to do it:
Make sure you build your solution once after adding the packages and before you do this, or else, the NuGet command will not do anything!
From VS 2010, Go to tools –>
The NuGet consolse will show up – Make sure the project you installed NHibernate and FluentNHibernate to is the one selected in the console:
Then type “Add-“ (no quotes) and press TAB, you’ll get intellisense, choose from there “Add-BindingRedirect” (no quotes) and press ENTER.
This should get you the following result (If not, try to build your project and do it again):
Now, you should find you application configuration file (web.config for web projects, app.config otherwise) having a similar section to this one (NuGet will create the file if not exists):
This is the assembly redirection that should allow things to work. Try it!
What Libraries on Nuget are updated to support NHibernate 3.1?
By the time of writing, the only package that supports NHibenrate 3.1 package is ConfORM (also created by Fabio
There is another package on NuGet called NHibernate.Linq. Do NOT install this package is you work with NHibernate 3.x. This is the old LINQ provider that is created for NHibernate 2.1, and is no longer maintained.
LINQ support is now built into NHibenrate itself, not any separate package.
Boring Introductions Pushed To The End
If you feel lost going through this post, check out the below questions. If you still have confusion, just leave a comment with your question.
What is there in NHibernate 3.1.0?
Starting NHibernate 3.0.400, NHibernate ORM had interesting features like LINQ support and new query API called QueryOver, as long as hooks for writing entity mapping by code (as used in another library called ConfORM).
NHibernate 3.1.0 adds more LINQ support for more use cases, and adds more bug fixes and improvements on the same paths as 3.0.
What is NuGet?
If you know Ruby/Rails, it’s enough to say it’s Microsoft equivalent of Ruby Gems. Since few of my readers are Ruby guys. I’d explain this by saying it’s a tool that allows you to get software libraries (like NHibernate, Log4Net, Entity Framework 4 Code First CTPs, Castle Windsor etc..) from central repository (feed) where they are published. It allows you to get the library and all its dependencies (for example, NHibernate depends on Iesi.Collections) at one time without having to worry what those are. Each library is expressed by a package, where the package creator can include the library as code or binary and define library version and dependencies of other libraries/packages, and you just point your Visual Studio at the package and get them all, and easily update to future versions later.
It also comes with a PowerShell console inside Visual Studio that allows you to run those commands via scripts and do some interesting things like have libraries that support different versions of dependencies than the latest versions to support those latest versions by assembly redirection.
The instructions have been tested on Visual Studio 2010, 2012, 2013, and 2015.
In VS 2010, extension manager is part of a nice new generation of VS plug-in system. One of the great features of it is how it can go online talk to Microsoft Visual Studio Gallery website to retrieve list of extensions there, automatically discovering updates for installed extensions, and allowing me to add new extensions directly from within Visual Studio.
However, in my company I could not take benefit of that for long time. Reason is, the company uses Blue Coat proxy, with some active directory based authentication. We cannot access the Internet unless we use that proxy, no direct connection allowed, most other proxies are also blocked (by blocking the common proxies port 8080 and many other common ports).
Although I have the proxy set in Internet Explorer, and I have the username/password stored in my Windows Credentials store (Start–> Run–> Control PanelAll Control Panel ItemsCredential Manager) -since my primary work laptop and user account on it are not part of the company domain-, Visual Studio did not seem to be able to use that.
Anything that requires online communication not directly using the browser is not working. The main feature missed by this is Extensions Manager integration with the Visual Studio Gallery online.
Another side effect of the problem was when running tests with TestDriven.NET test runner (running using Debugger or In-Process), as I had some tests that required connecting to online websites.
It turns out (just by guessing and trial-error way) that the default proxy settings for .NET apps is for some reason not to use the system proxy and credentials. Visual Studio will be default ignore that proxy (and many other .NET applications will).
Thanks God, .NET applications have a nice extensibility feature for things like this using the app.config file (if it was unmanaged application, I’d have no way to it).
Troubleshooting this issue in TestDriven.NET was what inspired me to get this, as I was trying to setup the credentials in the app.config file of the test project and then in Visual Studio.
So, I needed to setup the proxy settings in the Visual Studio config file., Knowing the Visual Studio IDE executable “devenv.exe”, the file I’m looking for is “devenv.exe.config”. I didn’t need to create that file (which is easy, just a standard .config file with the same name as the executable including “.exe”) because Visual Studio already has a config file with bunch of existing configuration defaults.
I want to the Visual Studio 2010 shortcut in Start-> All Programs, right clicked it, then chose “Properties”.
In the following properties Window, I clicked “Open file Location”:
This took me to the Visual Studio folder that has the “devenv.exe” and “devenv.exe.config” files:
I opened this file in Visual Studio (yes, it’s OK – the effected showed after restarting VS of course):
The section I was looking for is under “<system.net>”. The config file already had this section to enable IPv6 (which is not enabled by default, yet another interesting default and override – I commented the override anyway later).
First off, thank you all so much who have attended the very special gathering of dotNETwork user group, Code Camp ‘09, that took place in the British University in Cairo (BUE) during last Thursday and Friday. This has been one of the biggest events I have been talking in, and that was a great honor.
You can find the slides for the sessions I have been giving below:
(Note: Links to the source code are in the last slide)
Notes On The Event
The speakers and dotNETwork Team
The event went with a similar theme to Microsoft Middle east Developer’s Conference, MDC, which became Egyptian Developers Conference, EDC, which used to take place annually in the beginning of February, but, is yet to happen this year. I’m not sure whether I should be happy or sad for the fact that many attendees came to the event thinking it’s organized by Microsoft as another replacement to MDC/EDC. To make this clear, Code Camp is organized by an independent user group of 11 organizers, known as dotNETwork group (I mentioned a lot in my blog), and was sponsored by Microsoft Egypt, and number of international companies (sponsoring foreign speakers transportation), and the British University in Egypt (BUE, hosting the event). All speakers (foreigners and Egyptians) are volunteers.
Within tow days, with over 300 attendees, and over 10 speakers from both Egypt and world wide, and a great variety in topics, dotNETwork has excelled to make this a GREAT experience for everybody. This is one of the best events I have attended ever in general, which compares with great improvement to the other best events/sessions I have ever attended/delivered: MDC 2005 (if you skip the Bill Gates pat!) and SilverKey Demo Day II.
Thank you very much dotNETwork and great attendance for the true nice time!
PS. I have notes from the other sessions I have been to as an attendee not as a speaker. Those will be available by the ened of the week or beginning next week (God Willing). Hopefully this time I’ll make it in schedule.