ObservableDeveloper - Leonid Sorokin's Blog

.NET, Silverlight, ASP.NET, Web Services, SQL Server, Cloud Computing, and much more...

About the author

I am a .NET Software Developer, Consultant, and Trainer from Toronto, Canada specializing in web development with Rich Internet Applications on the Microsoft development tool chain.

My Photo

Microsoft Certified Professional Developer

How to run Visual Studio as administrator on Vista (with UAC)

I just ran into a strange problem on Windows Vista that touches upon Visual Studio 2008 and IIS 7.

I created a WCF Service Application project and in the properties I set it up to use the Local IIS Web Server (i.e. not Cassini). So far so good.

However, when I opened my solution file later on, Visual Studio complained that I was not running it under an Administrator account, and failed to load that project.

It turns out that if UAC (User Access Control) is enabled, Visual Studio does not run under an admin account automatically, and as such I had three choices:

  • Disable UAC on Windows Vista (I know it’s annoying but it does do a good job at protecting your machine)
  • Run Visual Studio as Administrator explicitly (really annoying…what if I forget? Besides, I usually like to open my .sln files by double-clicking via Windows Explorer)
  • Setup Visual Studio to run as administrator automatically (I think this is the best option)
    • Go to C:\Program Files\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe and C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe (could be different depending on your version), right-click on each one, and go to Properties. Under the Compatibility tab, make sure to choose Run as Administrator. Now when you run Visual Studio, it will automatically prompt you with the UAC, which is really what you want. Of course, this approach will work with any other program and not just Visual Studio. If you encounter any further issues, read http://www.pluralsight.com/community/blogs/matt/archive/2007/05/21/47446.aspx.

Now back to work…


Permalink | Comments (0) | Post RSSRSS comment feed

Visualizing LINQ Expression Trees for In-Memory data sources

Have you ever encountered the need to see how Expression Trees are built but you are working with a collection of memory objects and not LINQ to SQL?

First, you should try to download the Expression Tree Visualizer for Visual Studio. You can find a nice post about it @ http://blogs.msdn.com/charlie/archive/2008/02/13/linq-farm-seed-using-the-expression-tree-visualizer.aspx

You can also try LINQPad, since it has a pretty good Expression Tree Visualizer. You can download LINQPad from http://www.linqpad.net/. LINQPad allows you to create code-snippets (very useful for creating temporary ad-hoc queries to try stuff out).

Now back to my original question…

After you have set up the Expression Tree Visualizer for Visual Studio, you can see the expression tree for a LINQ to SQL query in the debugger – cool. Now, you write a LINQ to Objects query and attempt to view the expression tree in the debugger – oh, oh, there is no expression tree visible!

The simplified explanation is that LINQ to SQL uses IQueryable as the data source while LINQ to Objects uses IEnumerable. Therefore, in order to fix this issue, all you need to do is call the extension method AsQueryable() on your in-memory data source. Now, when you use the debugger, you will be able to see the expression tree that was generated!

Happy LINQin’ :)


Permalink | Comments (2) | Post RSSRSS comment feed

How to configure Subversion (SVN) Source Control with Visual Studio 2008 Professional

If you find yourself working with Visual Studio 2008 Professional, but you are not a millionaire, yet, and you are in desperate need of source control, I have the following to say to you:

Consider downloading VisualSVN Server, TortoiseSVN, and AnkhSVN.

Well, it’s Free!

  • VisualSVN Server is analogous to Microsoft Team Foundation Server
  • AnkhSVN is analogous to Team Explorer for Visual Studio
  • TortoiseSVN has nothing comparable in the Microsoft world, but it’s great. You can basically check-in, check-out, merge, diff, etc, directly from Windows Explorer

Underneath, all of them are running Subversion as the “brain”, which is a really good source control system. I am using this configuration with two networked computers and it works rather well.

Based on my experience, I recommend you setup VisualSVN Server to use custom users and groups. If you use Windows Authentication you may run into strange problems when you start to have many computers networked together.

All in all, I have used Subversion for about two weeks, and I am quite happy with it. It is definitely comparable to Team System, and I would highly recommend it in replace of Team System for small teams.

You can find a really thorough “getting started” guide @ http://www.codeproject.com/KB/dotnet/VistaVisualSourceControl.aspx


Permalink | Comments (0) | Post RSSRSS comment feed