Visual Studio

Using Visual Studio and plugins for Visual Studio.

How to Add a VSIX Installer to a DXCore Plugin

As of CodeRush/Refactor/DXCore 11.2, DXCore supports installation of plugins using Visual Studio Extensibility (VSIX) just like any other extension you might find in the gallery. This is beyond cool for a couple of reasons. First, I've been [slowly] working on a couple of different ways to create some nature of "plugin gallery" for DXCore extensions. There are so many community plugins, plus things like CR_Documentor and CR_CodeTweet that aren't on the community plugin site, that it's really hard to know what's out there. This would allow DXCore plugins to use the standard Visual Studio Gallery mechanism for browsing. ...

WCF Fails to Build or Update Service Reference When Path Too Long

I was working yesterday on a solution in Visual Studio and noticed that every time I'd rebuild VS would report the build as failed... but without any error messages. I thought it was just a fluke, but then I had to update a service reference. When I tried, I got the following error message: Could not resolve mscorlib for target framework ".NETFramework,v4.0". This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted. I searched all over and verified the TargetFramework settings on every project. No...

MVC3 Project Template Requires Solution Node in Solution Explorer

I've got Visual Studio 2010, MVC3, and the latest tools update. I'm all patched up. But I'm seeing something weird. I start out and I have a solution with a single C# class library in it. I decide to add an MVC3 site to it, so I do File -> Add New Project. I select an MVC3 project. I click OK, and I select an Empty web application. When I click OK on this screen, I get an error "Cannot add the item because the item to add it to...

NuGet Doesn't Help Me

There's been a lot of hoopla around NuGet and the whole .NET package management "thing." There's a lot of praise going around, and I think they've done a good job for what they're doing. That said, I have what I'm sure is going to be an unpopular opinion: NuGet doesn't help me. It seems to me the primary benefits of NuGet are: Get third-party dependencies into new projects faster. Help you more easily update packages in your project. That's all well and good, but I think...

Adding Top Level Menu Integration to a DXCore Plugin

Most of the DXCore/CodeRush plugins I write are Tool Window plugins like CR_Documentor or are plugins you'd bind to a hot key like CR_JoinLines. For Tool Windows, DXCore automatically gives you menu integration... ...and for hot key plugins, you don't need it. But sometimes your plugin isn't really a tool window, or maybe you need to integrate into a different menu, like the standard "Tools" menu. I'll show you how to do that. Before you begin, consider if you really need this. It's not hard to add, but if you're like me, you already have a...

Open Letter to Visual Studio Extension Developers

Dear Visual Studio Extension Developers: (This includes folks who create products that have "value-add" features that install into Visual Studio, extensions done through classic or new mechanisms, and/or anyone who has something that otherwise "bolts on" to VS to enhance the development experience.) I have a lot of different products, add-ins, and extensions installed in Visual Studio. Most of them behave reasonably, but I've had some recent bad luck with a couple that have caused... frustration. This is to ask you to help me. Help me enjoy your product. Help me not be frustrated. Help me be...

Test Your Deployed Web Site Package with IIS Express and Visual Studio

With the ability to transform your web.config file when deploying your web site came, at least for me, a question: How do I test my web site's behavior without deploying a whole copy of my web site? I figured out a reasonable, if slightly kludgy, solution and I figured I'd share. The general idea is to have a project in Visual Studio that... Acts as the point of entry for debugging the packaged version of the web site. Automatically updates IIS Express configuration to point to the packaged web site. ...

How to Pass Parameters to FxCop from Visual Studio - OR - How to Fix the Dreaded CA0060 Warning

If you've enabled FxCop to run on your projects in Visual Studio, chances are you've seen the dreaded CA0060 warning: MSBUILD : warning : CA0060 : The indirectly-referenced assembly 'SomeAssembly, Version=1.2.3.4, Culture=neutral, PublicKeyToken=abcdef1234567890' could not be found. This assembly is not required for analysis, however, analysis results could be incomplete. This assembly was referenced by: C:\Path\To\Some\Dependency.dll. The MSDN docs on this warning say that you should just add a reference to the indirectly referenced assembly so FxCop can find it. The problem is, if you already have a reference to a later version of...

IIS Express Adds a (Possibly Duplicate) Certificate During Install

When you install IIS Express it also installs a self-signed certificate that it will use for SSL. This is not normally a problem, however, if you already have a self-signed certificate, it may result in a confusing issue where you have two certificates with the same distinguished name, like so: And why would that be a problem? Say you are working with WCF services that need to identify themselves with certificates. You have your dev machine set up to use the self-signed certificate, like so: <serviceCredentials> <serviceCertificate x509FindType="FindBySubjectDistinguishedName" findValue="CN=localhost" ...

Running Typemock Isolator Outside Visual Studio

I've blogged before about getting Typemock, NUnit, and NCover all working together in MSBuild. Though that's admittedly a tad stale, with a bit of tweaking the contents of that article still apply. I got a question about running tests that use Typemock Isolator outside of Visual Studio, though, so I figured I'd post this article with some additional info and clarifications. First, the setup: NCover 3.4.16 Typemock Isolator 6.0.6 MSTest with Visual Studio 2010 If you have different versions of these tools, you...

Make Your DXCore Plugin Official with a ProductModule

Have you ever looked at the DevExpress menu in Visual Studio and selected the "About" option? There's a list in there of all the installed "products" with associated version information, a textual description, and even a graphic with the product logo: If you have the CR_Documentor plugin installed, you'll notice it also shows up in that box: If you want to "make your plugin an official product" and show up in the "About" box, the way to do that is to implement a ProductModule. Before we get into this, something to consider: You probably don't need or want to implement a ProductModule for...

CR_Documentor 2.5.0.0 Released

It's been a while in the making, but the new version of CR_Documentor is out. It took a while because I did two pretty major updates to it. First, I totally overhauled the syntax preview generation so each preview style (NDoc or Sandcastle) uses the same syntax preview engine. As part of that, I added a bunch more testing and support for complex syntax like multiple type parameters with multiple type constraints per parameter. What? What does that mean? It means you can see stuff like this in your preview: And, of course, it works in VB, too (which, based on the way...

Switch Default Browser in Visual Studio without "Browse With..."

Visual Studio has a nasty habit of forgetting your default browser settings at seemingly arbitrary times. Couple that with the fact that you can only really switch your default browser in VS using this "Browse With..." context menu on a browsable ASPX or HTML page (and the fact that in your MVC solutions you probably don't have a directly browsable ASPX or HTML page) and this whole thing is a nightmare. Enter Hanselman, who has posted a Powershell solution to the problem. YAY!

Developing as a Non-Admin: Testing WCF Services

If you're developing as a non-admin user and writing WCF services (or supporting entities like behaviors, etc.), you probably not only are unit testing the code but also want to write an integration test or two that actually fires up a real WCF service, makes a couple of requests, and validates the responses. You may also have seen this exception: System.ServiceModel.AddressAccessDeniedException : HTTP could not register URL http://+:1234/ServiceUnderTest/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details). Following that link, you'll see that the reason you can't start your service listening to...

DX_FormatOnSave - Format Documents in Visual Studio When You Save

Visual Studio allows you to specify different code formatting rules for different languages it understands, but in many cases the formatting only applies to new code you're writing. For example, C# lines generally get formatted when you hit the end of the line and type the semicolon... but the only line that gets formatted is the one you just completed. Wouldn't it be nice if the whole document would adhere to the same formatting without you having to pay attention to it? With this plugin, you can automatically have Visual Studio apply code formatting to the entire document...