Visual Studio

Using Visual Studio and plugins for Visual Studio.

Upgrading NuGet - The process cannot access the file because it is being used by another process

I tried to update to the latest version of NuGet in Visual Studio recently and failed. Miserably. The error I kept getting was: The process cannot access the file because it is being used by another process. Totally generic, not even any info about the file being locked. Looking in the log, I see the following error: 7/29/2013 7:30:36 AM - Install Error : System.IO.IOException: The process cannot access the file because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError() at System.IO.File.InternalMove(String sourceFileName, String...

Setting DependentUpon File Properties on NuGet Package Install

In working on some NuGet packages, one thing I wanted to do was set up some configuration files in preparation for SlowCheetah integration. Instead of seeing a folder structure like this in the project… ~/Config MyConfig.config MyConfig.Debug.config MyConfig.Release.config I wanted to see the file dependencies set up like you usually get with Web.config: ...

Gave Up Trying FxCop 11 Standalone

In FxCop 10 you could run code analysis without installing Visual Studio by either grabbing just the FxCop stuff out of Visual Studio or installing the Windows SDK. Not so, with FxCop 11. There's no longer a standalone installer - it's been removed from the Windows SDK. I tried grabbing the FxCop out of Visual Studio 2012 and it fails with the exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.CodeAnalysis.Interop.dll' or one of its dependencies. The specified module could not be found. Using Dependency Walker on Microsoft.VisualStudio.CodeAnalysis.Interop.dll, you can see a ton of missing assembly references:...

Can You Run Visual Studio in Azure?

UPDATE 6/1/2013: As of June 1, 2013, the licensing has been updated so you can run all of your MSDN software except Windows client and Windows Server on Azure. This is outlined in the licensing whitepaper. I'll leave the below discussion in place for posterity but the latest update has rendered it irrelevant. I was sitting at the car repair place on Saturday with my Surface RT thinking it'd be nice to have a Visual Studio instance to tinker with. Given I have an MSDN subscription that comes with a free Azure VM and Visual Studio, it made sense to me...

Use CodeRush Templates to Help Write XML API Documentation

I write a lot of API documentation. I do it to help the people consuming my code... and to help me a year from now when I have to come back and can't remember how the thing works. I have CR_Documentor out there to help you see what your docs will look like rendered, but sometimes you also need help getting the content right. Your first stop should be GhostDoc to get some basic bits in place. GhostDoc doesn't actually write good documentation, but it can help you get things started. After that, though, you may need some easy...

Windows "Command Prompt Here" Generator

I love context menu "command prompt here" shortcuts. Every time a new VS version comes out, or a different prompt is available that I need, I create a new one. In the past, I've tried to maintain a whole roundup of current versions, but that's been tough. Different operating systems come out, I need to tweak this or that to make things work, and I end up having to edit and re-package the whole bundle. It's also a pain for people wanting the installers – you want some, but not all; the tool isn't quite what you want but...

Using CodeRush Duplicate Code Detection in a Real Project

I'm working on a fairly major refactoring project, merging a couple of fairly large libraries together that have some overlapping/similar functionality. I figured this would be the perfect time to try out the reasonably new CodeRush Duplicate Code Detection feature. The solution I'm working on has eight projects - four unit test projects, four shipping class libraries, and a total of 1248 C# code files. I didn't have duplicate code detection running in the background during the initial pass at the merge. Instead, I ran the detection after the initial pass to indicate some pain points where I...

CR_Documentor 3.0.0.0 is in the Visual Studio Gallery

I'm pleased to announce I've got the CR_Documentor 3.0.0.0 release up and running in the Visual Studio Gallery! You can either get it from the gallery, or, from the Visual Studio Extension Manager, search for "documentor," "dxcore," "coderush," or other related terms and it'll come up. It's a full VSIX installer, so it'll install right into Visual Studio without you needing to download, unzip, or do anything additional. (I think I'm the first DXCore plugin with a VSIX installer to appear in the gallery, so... I have to say, I'm a little proud. Huge props...

CR_Documentor 3.0.0.0 Released

The latest version of CR_Documentor, 3.0.0.0,  has been released. This version is an update to .NET 4 in preparation for a VSIX-based installer (think Visual Studio Gallery) so it will only support Visual Studio 2010. It also resolves a small issue where some interfaces changed in DXCore 11.2.8 and the plugin was throwing exceptions. You will need the latest CodeRush/Refactor/DXCore (11.2.8) or things may not work. (I admittedly haven't tried it on earlier versions.) Free, as always, so go get it! And watch for the VSIX installer, coming soon!

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...