How to export settings from Visual Studio 2010 to Visual Studio 2008

This is particularly helpful when you want to copy colour settings / Visual Studio theme from one machine to another or across different versions of VS you have (say at your laptop and some customer’s PC)

Simply get the VS2010 import file, right click, open with, choose a program, and pick any simple editor, say Notepad


Yeah, you got it, what you need is to change:


Now you can use that in VS2008 Without any problem…

Visual Studio “Run As Administrator” Only From Shortcut


Last week I had to re-install Windows. I haven’t done it in a while, so, had to remember all those “1 time” tips I do after reinstall. For example, downloading SQL Server Developer Edition before Visual Studio to get the full Management Studio. Another example, setting Visual Studio to pin to the Start menu, and configuring it for UAC.

The Problem

In the very first year of Windows 7, I used to have many problems with UAC on and always disabled it, later, things started to get better and it became my normal config to leave it on. One problem that remained is that if you have a program set to always “Run AS Administrator”, if this program has associated files (can open files with certain extensions if you click the files), you no longer can open those files directly.

So, like many, I do pin visual studio to the Start menu


I also need to set it to “Run As Administrator” in so many times (for stuff with built-in IIS, not much is on IIS Express).

I right click the shortcut, go to “Compatibility” tab, and check “Run this program as an administrator”.


Note that this if done with any shortcut to Visual Studio devenv.exe file, has the same effect of doing it on the EXE directly, which is making the EXE require Admin permissions whenever run.


The problem is, when I do that, clicking any .CS or .SLN file doesn’t work in Visual Studio…


So, I had either the option to remember to open Visual Studio as Administrator when required (and restart it if open without Admin privileges) or I have to open files only from Start menu shortcuts and pinned shortcuts and VS File –> Open


Both are bad, because it’s very common for me to work on projects when I’m confortable with having VS run as admin, and many times also I get source code from the Internet and I just want to click an SLN file in Windows Explorer or even a CS file inside zip/rar file and quickly browse the code in the solution / file.


The Solution

One thing I discovered later, is that you can actually set only a shortcut to open the EXE as administrator, so that other shortcuts and the System itself opening the EXE will not require that permission.


So, how can you do that? I right click the shortcut, choose “Properties” as usual, but this time I go to another tab, “Shortcut”, then click “Advanced”, and then check the OTHER “Run as administrator” checkbox:



The plan is simple. I apply this to the shortcut pinned to the Start menu and the task bar, so, whenever I click any of those, I get Visual Studio running as Administrator, but, when I open a file from Windows Explorer or Zip/Rar file, I do NOT run VS as Administrator (because as mentioned above, it won’t work anyway).



This is not much of a very secret trick or something, but I’m trying to get back to blogging more and more by writing anything that comes to my head like this one. You ideas are always welcome either on this one or on other topics you might want me to blog about.



Visual Studio 2008 Service Pack 1 Released [No More BETAs for this Version]

Very Quick Note: Visual Studio 2008 Service Pack 1 was released finally (in combination with .NET Framework 3.5 Service Pack 1 of course).

To sum up for some people, note that VS 2008 SP1 includes ADO.NET Entity framework (and its designer) as well as ADO.NET Data Services, but NOT ASP.NEt MVC framework (but does include ASP.NET Dynamic Data & ASP.NET AJAX history control and script combining). It also includes some WCF enhancements as well as major VS performance and scalability fixes.



SQL Server 2008 also was released earlier last week.

See official page for SQL Server 2008:


Converting Visual Studio Website to Web Application Project

Click here to go directly to the instructions…

Background (Click above to skip if you know Web Application Projects)

In VS 2002/2003, the web project model for a website was similar to “class library” projects, where you have a .CSPROJ or .VBPROJ file that keeps track of files “included” in the project, and compiles all the pages and controls code behind to a single assembly under “bin”. Each page/control has an automatically generated .DESIGNER.CS or .DESIGNER.VB file, which contains objects mapping to the server controls in the page/control markup (the generation of those files was not always in synch with markup, and that was problematic).

With VS 2005, there was a new “website” model for web projects that compiles each page/control individually as a separate assembly (or each folder, depending on optimization features), and applies this to all files in a given directory and its sub folders. This was a total mess in most “real world” projects, as VS takes so long to build the entire website, and even at deployment, you get sometimes many problems when you have pages that “reference” other pages/controls when IIS it trying to dynamically load the right assemblies to reference, and many other problems.

So, Microsoft came with a new add in to VS 2005 called “Web Application Projects“. This is typically the same old VS 2002/2003 project model with no problems in generating DESIGNER files and with integration with both IIS and ASP.NET development server that comes embedded in VS 2005/2008. It was later merged with VS 2005 SP1, and shipped as part of VS 2008 (without removing the “website” model). Note that most stuff that has to do with Microsoft like ASP.NET AJAX Toolkit Sample website and so are actually “web applications” not “websites”.

The problem

Typically, when you are converting any project from VS 2003 to VS 2005 SP1, it converts as “web application” not “website”. You can also convert a “website” to a “web application”. There’s an option “Convert to web application” to look for.

In my company, all our web projects are “web applications”, well, except that other web project I was code reviewing and helping with its deployment! After spending number of days with the brilliant team and not finding as many items to code review and getting sick of some problems at sometime in deployment, I cried to them to convert it to to “web application” (maybe I was looking for some job to be doing :D). Very confidently, I said, ” remember the option exists and I did conversion before in VS 2005. All it takes is a right click on the ‘website’ root node in solution explorer in VS 2008 and ‘Convert to web application’. It almost never causes any problems, and we have our source control anyway”.

They believed they had time to do it, so, they went to look for that menu item  “Convert to web application” and guess what ? They didn’t find it! They tried resetting VS 2008 settings and everything, and still, nothing there!!! Yeah, it was embarrassing :D :D :D

Workaround, or, how to convert a “website” to “web application” in VS 2008

Well, it turns out that the option “Convert to web application” does NOT exist for “websites”. The option “Convert to web application” does exist only for “web applications” !!!!

So, here’s the deal, to do the conversion, you need to:

  • Add a new “Web Application” to your VS 2008 solution (File->Add->New Project->C#->Web->ASP.NET Web Application).
  • Afterwards, you copy all the files in the old “website” to your newly created “web application”, and override any files created in it by default
  • The next step is the most ugly, you need to “manually” add the references in your “website” to the new “web application”. I thought the VS 2008 PowerCommands toy would do this for me as it does copy references from other project types, but it didn’t. You have to do it by yourself, manually, and you have to be cautious in this step if you have multiple versions of the same assembly (like AJAXToolkit in my case) or assemblies that have both GAC and local versions or so.
  • Keep repeating the last step and trying to build the “web application”. You’ll keep getting errors like ” ‘….’ is unknown namespace. Are you missing an assembly reference? “. Make sure you have none of those except the ones where ‘….’ is replaced by the IDs of the server controls you use. In other words, keep adding references and building the project until only the errors that exist because of missing .DESIGNER.CS or .DESIGNER.VB files.
  • Afterwards, go to the “web application” root project node in VS 2008 solution explorer, and right click it, then you WILL find the option “Convert to web application”. What this option does is actually making small changes to the “@Page” and “@Control” directives of pages and controls, and creating the required .DESIGNER.CS or .DESIGNER.VB files.
  • Try building the “web application” again. If you get errors, see what references may be missing and/or go click the “Convert to web application” again. Sometimes, if there’s any error other than those caused of missing DESIGNER files, not all the pages/controls will have those DESIGNER files created for them. Fixing the non DESIGNER problem and clicking “Convert to web application” again should do the job for this.
  • Once you are done successful VS build, you should be ready to go. Start testing your web application. Optionally, you can right click the “web application” root project node in VS 2008 Solution Explorer and click “Properties” then go to the tab “Web” to set the “web application” to a virtual folder in IIS (you can create new virtual directory from there in VS). If you want to use the IIS virtual directory that the old “website” used, you need to remove that from IIS first.
  • Update: When testing your pages, pay MOST ATTENTION to classes in “App_Code” folder, especially those with NO NAMESPACE. Those can be a big trap. We had a problem with two extension method overloads in the same static class that had no namespace,one extends DateTime? (Nullable<DateTime>) and calls another overload that extends DateTime itself. Calling the other overload as extension method passed VS 2008 compilation and gave us a compilation error ONLY IN RUNTIME (With IIS). Changing the call to the other overload from calling it as extension method to calling it as normal static method (only changing the call in the same class, calls from other classes remained extension method calls) did solve this one, but clearly, it’s not as safe as it used to be in VS 2005. Especially with classes with no namespaces.
  • Update2: During the conversion, VS 2008 renames your “App_Code” to “Old_App_Code”. This new name sounds ugly, but DO NOT RENAME IT BACK. In the “web application” model, all code will be in one assembly. In runtime, the web server does not know what web project type you are using. It does take all code in “App_Code” folder and create a new assembly for it. This way, if you have code in folder named “App_Code”, you’ll end up with RUNTIME compilation errors that the same types exist in two assemblies, the one created by VS, and the one created by IIS / ASP.NET Development Server. To avoid that. leave the “Old_App_Code” with the same name, or rename it to ANYTHING EXCEPT: “App_Code”. Do not place any code in such “App_Code” folder and prefereably do NOT have a folder with such name in your “web application” at all.
    I know this since before but forgot it now as I have not used “website” model for long :(.

I hope this helps anyone to avoid my embarrassment, and still get rid of the weird errors of “website” model :).

Resharper 4 BETA Released

Avoid Much Talk

I wrote about Resharper 4 performance improvements in an earlier blog post today showing my VS Color Scheme including use of R# nightly builds. My friend Mohamed Tayseer pointed me out that Resharper 4 BETA was released yesterday. If you already know Resharper, skip the blah blah blah talk and get to the download.

Resharper, AKA R#, Who ???

Resharper used to be a must-have add-in for Visual Studio. It completes the features existing in Visual Studio like intellisense (not just smarter intellisense, but also available everywhere, like those areas in ASP.NET markup when you start typing non-standard code to Visual Studio to hook some properties and you get lost alone usually).

Of course it makes the expected enhancements to standard VS editor like parentheses and semicolon completion and other similar features, although it takes you w while to get used to stopping writing those after R# writes them for you!

It also has interesting stuff like SPEED find options (instead of this “Compiling the Solution” messages whenever you want to “Find Reference”) also extended for things like 2-way jump between the base classes / interfaces and their children classes/methods. ad also tons of “Guideline promoting” features like intellisense for  VARIABLE names (like when you type “MailMessage” for local variable type, it recommends names like “mailMessage”, “message”, etc…), and options to detect unused variables and “using” namespace directives, and many other features.

It also offers very handy icons that do interesting stuff like inverting “if” statements and reversing assignments (very handy in ASP.NET donkey code behind files, in an edit page, call on page load a method with all txtProductName.Text = currentProduct.ProductName;, copy that to the method that’s called from the “Save” button click, select it and click “Reverse Assignment”), and many great other features appearing as very small icons to the left of the code to not interrupt your work.

It’s also smart. It can realize that Console.WriteLine(“{0}, {1}”, object0); will fail because the string format method is a “string formatter method” and it expects two objects while I passed only one! It has tons of interesting warnings and recommendations like this. Leave apart small features like quick use of “var” instead of type and suggesting and quickly applying conversion of normal static method to extension method, and so many other features.

For more advanced users than me it has advanced code snippets style and advanced template engine and advanced plug-in model for extending all features it offers (some interesting plug-ins), but I never used those … too advanced for my “code monkey” use of VS :D. It even has integration with Testing frameworks, although TestDriven.NET already also handles this for me.

Resharper – Major Turnoff Removed

Earlier, the worst thing that prevented me totally from recommending it to friends (besides the price, I believe it is expensive [$199 for personal use, $149 if skipping VB.NET support], especially when you convert US dollar$ to Egyptian pounds :D) was the performance issue. With a 15+ VS solution each of over 15 classes (not small ones), you get slow down at project opening and many times at typing (while it’s trying to get the smart intellisense or other great features to me).

This also cost A LOT of memory. I had a friend who installed it only in code review sessions and uninstalled it just after the code review because how greedy it is in terms of RAM. Things got a little better from R# 2 to 3, but also my work got bigger at the same time, so, it felt tedious.

Now with Resharper 4 (still in BETA) this is no longer an issue. I totally do not notice a difference in Visual Studio whether Resharper is there or not. This makes it great to develop and complete the parts that are missing and are actually must-have features Microsoft is missing in Visual Studio. It’s a really elegant piece of work.

I’d still worry about pricing, especially vs. FREE Visual Studio (you get via your company’s MSDN subscription usually, so, it “feels” free to you), but this is another story.

Reshaper 4 BETA News / Download

In my last post, I put a note about R# 4 nightly builds performance that more than anybody targeted mainly Mohamed Tayseer, my colleague who used R# only in some code review sessions and uninstalled it just after. A few hours later he returned the favor by pointing me out that R# 4 BETA was announced yesterday.

BTW, if you haven’t guessed already, R# 4 BETA is a FREE evaluation version.

Here are the related resources:

Dark Visual Studio W/ Resharper – My VS Settings (Colors, Windows Layout, …) – V2


I blogged my old Visual Studio settings before for Visual Studio 2005, using a dark color theme and optimizing it for Resharper features like Resharper colorings and “Current Line Highlight”.

Today I’m sharing with you my settings for VS 2008. Things have changed a bit since the first time, so, you’ll find the layout different and colors as well, although still dark as well.

The one thing to notice is using “Lucida Console” font instead of the popular “Consolas”. Also, if things look a bit small to you, this is because I’m using “Lucida Console” with size 9, and my entire Windows OS layout is using “Arial Unicode MS” font with size “7”. It’s killing for someone with sight shortage, but you never get enough of a 15 inch laptop screen, even if wide one!

By the way, the version of Resharper used with VS 2008 is the latest of the nightly builds of Resharper 4. The best thing I like about it besides supporting C# 3.0 of course is the performance improvements. Now “Solution Wide Analysis” is off by default and I still get most of the features I need of Resharper. Maybe This is the reason for the massive performance increase or whatever the reason, it’s just nice.

You can download my settings right here:

File iconVS_Dark_Colors-W-Resharper-20080522.vssettings

By the way, if you are interested in how my old VS settings looked like, check this:

Visual Studio 2008 SP1 BETA

Microsoft .NET framework 3.5 Service Pack 1 and Visual Studio 2008 Service Pack 1 now have public BETAs. The service pack of Visual Studio 2008 has really interesting stuff.

Highlights I’m interested in are performance improvements in HTML editor, collection of JavaScript intellisense hotfixes plus new ones enabling better JavaScript intellisense for libraries like jQuery, JavaScript Code Formatting, ASP.NET Routing engine (the one used in ASP.NET MVC, it is actually developed as separate component), new release of the Entity Framework and LINQ to Entities and ADO.NET Data Services, WCF tools, minor C# editor improvements and interesting LINQ to SQL debugging improvements.

Other improvements include ASP.NET AJAX history management (browser back button support), ASP Classic server-side code intellisense fix, new desktop applications installation model called "Client-only Subset", ClickOnce improvements, various WPF improvements, and some new WPF and Windows Forms controls.

This post is not for repeating the announcements, instead referring to other related content:


Egypt: Heroes Happen Here (AKA, Microsoft 2008 Launch Event in Cairo)

It’s very nice to know that the launch event is not merged with EDC 2008, but comes before it. The 2008 launch event covers VS 2008, Win 2008 and SQL 2008.

It’ll be held March 24th @ Intercontinental City Stars Hotel (Register Now)

The agenda:

Time General Sessions
09:00 AM – 10:00 AM Registration / Coffee
10:00 AM – 11:15 AM Keynote Speech
11:15 AM – 11:45 AM Break
Infrastructure Track Database & Development Track
11:45 AM – 12:30 PM Windows Server 2008 Overview Breakthrough software development challenges with Visual Studio 2008
12:30 PM – 13:15 PM Windows Server 2008 Security and Compliance Technology Reach end users with Next Generation Web Applications
13:15 PM – 14:15 PM Lunch
14:15 PM – 15:00 PM Windows Server 2008 Virtualization Technologies Build and Deploy Data Applications with SQL Server 2008
15:00 PM – 15:45 PM Windows Server 2008 Web and Application Technologies SQL Server 2008 Business Intelligence Platform
15:45 PM – 16:00 PM Closing


Found Via Amir Magdy.

ASP.NET 3.5 Extensions, MVC, Expression Studio and Silverlight & IE 8 Preview Updates

With MIX, and meeting the announced MVC roadmap, the new versions of AS.NET Extensions are now publicly available.ASP.NET MVC Framework Preview 2 is available also as separate download, same as Silverlight 2.0 BETA 1 (and Expression studio, Silverlight VS 2008 Tools).

Download Links:

Additional Resources:

  • Announcements

    Have fun :)