The strange case of “Error 1606: Could not access network location VS Developers” installing SP1 of Visual Studio .NET 2003

At the time of this writing there are three Visual Studio versions out there (VS 2005, 2008 and 2010) that support .NET Framework 2.0 and with an extensibility model that allows you to create a single binary add-in dll to target all of them (see HOWTO: Create an add-in that targets several Visual Studio versions with the same add-in DLL using C# or VB.NET). So I wouldn’t support Visual Studio .NET 2003 in a new add-in created today, but my old MZ-Tools 6.0 add-in still supports Visual Studio .NET 2003. On the other hand, the current OS today is Windows 7 64-bit, and, alas, VS.NET 2003 is not supported by Microsoft in that Windows version. Not being supported doesn’t mean that it doesn’t work, specially if you want it only to test an add-in, not for actual development of projects, so I have it installed on Windows 7 64-bit despite all compatibility issues warnings during installation.

Yesterday I wanted to install SP1 of VS.NET 2003, that I noticed that I hadn’t installed, so executed the VS7.1sp1-KB918007-X86.exe setup just by double-clicking it. I got a warning about a security of files from Internet but I authorized its execution. At some point of the installation, I got this error:

“Error 1606: Could not access network location VS Developers (could not create group)”

This problem is caused if you have the User Account Control (UAC) feature of Windows Vista or Windows 7 activated. It happens that this setup was created before Windows Vista and therefore it is not UAC-compliant (it lacks a manifest). So, how does Windows Vista / 7 know if this executable requires admin rights? Windows Vista / 7 knows that most executables that are setups require admin rights, so when the UAC manisfest is missing, it applies some heuristic rules to guess if an executable is a setup or installer. In this case all rules failed, including the most usual one (the name includes the “setup” word) and UAC determined that VS7.1sp1-KB918007-X86.exe was not a setup and didn’t require admin rights, which caused the error above at some point.

Of course the solution is to install VS7.1sp1-KB918007-X86.exe by right-clicking it and selecting the “Run as administrator” menu entry.

Another solution is to rename the setup file name to include the “setup” word, for example VS7.1sp1-KB918007-X86Setup.exe, so that UAC guesses that it is a setup and it prompts for admin consent or admin credentials to elevate privileges.

MZ-Tools Articles Series: PRB: Uninstaller of add-in for current user fails if Visual Studio set to execute as administrator

Another problem that can happen to an uninstaller of add-ins for the current user (not for all users) specially in Visual Studio 2005 (which require admin rights):

PRB: Uninstaller of add-in for current user fails if Visual Studio set to execute as administrator
http://www.mztools.com/articles/2011/MZ2011022.aspx

This issue affects these articles:

HOWTO: Create a setup for a Visual Studio add-in for the current user (not requiring admin rights) using Inno Setup
http://www.mztools.com/articles/2011/MZ2011018.aspx

HOWTO: Create a setup for a Visual Studio add-in for the current user (not requiring admin rights) using using Windows Installer XML (WiX)
http://www.mztools.com/articles/2011/MZ2011020.aspx

MZ-Tools Articles Series: PRB: Uninstaller does not remove commands of add-in if uninstalled from another user account

After all these weeks creating installers and uninstallers for add-ins, either for all users or for the current user, either using InnoSetup or MSI (through WiX), I have found quite a few issues. This is one of them:

PRB: Uninstaller does not remove commands of add-in if uninstalled from another user account
http://www.mztools.com/articles/2011/MZ2011021.aspx

This issue affects these two articles:

HOWTO: Create a setup for a Visual Studio add-in for all users (requiring admin rights) using Inno Setup
http://www.mztools.com/articles/2008/MZ2008010.aspx

HOWTO: Create a setup for a Visual Studio add-in for all users (requiring admin rights) using Windows Installer XML (WiX)
http://www.mztools.com/articles/2011/MZ2011019.aspx

MZ-Tools Articles Series: new articles about setups using Inno Setup and WiX

If extensibility with add-ins is hard sometimes (or most of the time), creating setups for add-ins is incredibly difficult always, no matter which installer technology you use. If COM-based add-ins of VS.NET 2002/2003 (still supported in VS 2005, 2008 and 2010) were complicated (they required COM-based registration and Windows Registry-based registration), XML-based add-ins of VS 2005 and higher (which only require file-based registration) are complicated too, and they are far from XCopy deployment, because:

  • You need to put an .AddIn file in one of several specific folders of choice, but they have a lot of problems (localized, different for Windows XP / Vista, new locations in new Visual Studio versions, hardcoded subfolders, locations that don’t work), etc.
  • You need to modify the .AddIn file to put its Assembly tag value pointing to the actual location of the dll file of the add-in, which requires a custom action.
  • And once you have your add-in installed, you are only half the way: uninstalling it is even more complicated due to the fact that you need to remove its commands, and that requires a custom action to either:
    • Create an instance of EnvDTE.DTE, iterate its commands and remove the ones of the add-in.
    • Execute the command line devenv.exe /ResetAddin <myaddin> /Command File.Exit. For some reason beyond me Microsoft decided that the /ResetAddIn should not open invisible the IDE, make its job resetting the add-in, and close it, so you need to pass the /Command File.Exit, but you have the problem that the IDE is visible (and maximized) for a second, and good luck making that custom action invisible because most installers know how to do that with console (MSDOS) command tools, but not with Windows applications such as devenv.exe.

Needless to say, I really do hate setups, and MSI the most (very complicated). So, when I learned about Windows Installer XML (Wix), a toolset that builds Windows installation packages (MSI) from XML source code, I decided to take a look. That was back in March 2010 (I remember I was on vacation at New York) and I found MSI and WiX so tricky that despite some (failed) attempts at spare time I have been procrastinating about it until this summer of 2011, when I finally succeeded (hopefully) creating a setup using WiX that works correcty in all scenarios (fresh install, change, uninstall).

Not only I have created setups for all users (requiring admin rights) but also setups for the current user (not requiring admin rights), approaches that require some discussion that will be the subject of a couple of small articles in the next days. Meantime, apart from this old article of 2008 (now renamed):

HOWTO: Create a setup for a Visual Studio add-in for all users (requiring admin rights) using Inno Setup
http://www.mztools.com/articles/2008/MZ2008010.aspx

I am very pleased of providing the following new samples:

HOWTO: Create a setup for a Visual Studio add-in for all users (requiring admin rights) using Windows Installer XML (WiX)
http://www.mztools.com/articles/2011/MZ2011019.aspx

HOWTO: Create a setup for a Visual Studio add-in for the current user (not requiring admin rights) using Inno Setup
http://www.mztools.com/articles/2011/MZ2011018.aspx

HOWTO: Create a setup for a Visual Studio add-in for the current user (not requiring admin rights) using Windows Installer XML (WiX)
http://www.mztools.com/articles/2011/MZ2011020.aspx

Visual Studio Extensibility (VSX) Forum FAQs about add-in development

There is a sticky VSX FAQ post in the Visual Studio Extensibility (VSX) Forum since more than one year ago that is intended to collect the FAQs about development of Visual Studio extensions (packages, add-ins, templates, isolated shell, etc.). Unfortunately there aren’t many FAQ entries in each category, which is a pity. Today I have added tons of them in the “Add-ins” category, my area of expertise, pointing to the most useful HOWTO articles of my MZTools Articles Series. Hopefully they are useful for people before posting in the forum:

VSX FAQ
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/0be62d3d-84b2-4e17-a306-bcc460621192

“The system administrator has set policies to prevent this installation” on Windows Server

I am these days creating setups of add-ins for Visual Studio using MSI and today when executing a setup intended for the current user (not for all users), not requiring admin rights, on Windows 2008 Server with a standard user account I have got the following error:

“The system administrator has set policies to prevent this installation”

I was not familiar with Windows Server and those policies but I needed a clean machine to test several setups and it happens that I had a clean virtual machine with Windows Server, SharePoint 2007 and Visual Studio 2010 so I used that. After searching the web I have learned that this problem is caused by the value DisableMSI (or lack of it) in the registry entry:

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer

See:

DisableMSI (Windows)
http://msdn.microsoft.com/en-us/library/aa368304.aspx

Creating that registry entry and name and setting its value to 0 solves the problem and a standard user can install a MSI setup that doesn’t require administrator privileges on Windows Server. Client Windows have a different behavior as explained in that article.

MZ-Tools Articles grouped by category

When I started the MZ-Tools articles series about developing add-ins for Visual Studio .NET some years ago, I didn’t think that its number would grow so much so I grouped them by type:

  • HOWTO
  • INFO
  • PRB
  • BUG

At this point, with 170 articles at the time of this writing, it was even difficult for me to locate the one that I was searching when answering questions in the forums, so I have grouped them now by category:

  • Articles about getting started and general information
  • Articles about commands, buttons and commandbars
  • Articles about toolwindows
  • Articles about getting information
  • Articles about custom pictures
  • Articles about the code model
  • Articles about Windows Forms
  • Articles about Web Forms
  • Articles about getting events
  • Articles about installing and uninstalling
  • Articles about troubleshooting, bugs and issues
  • Other articles

I may tweak the categories in the next weeks but for now I think it is much better now:

MZ-Tools Articles Series (about add-ins)
http://www.mztools.com/resources_vsnet_addins.aspx

MZ-Tools Articles Series: HOWTO: Create a CommandBarButton without a command from a Visual Studio .NET add-in

In the old times of Visual Basic 5.0 / 6.0 (which used the Office commandbars), those IDEs lacked the concept of commands that Visual Studio .NET 2002 introduced, and buttons (CommandBarButton) were created calling the CommandBar.Controls.Add method with suitable parameter values. The CommandBarButton class lacked the Click event (it was introduced in newer versions of Office) so a horrible hack to get events from buttons was provided.

It happens that Visual Studio .NET 2002 and higher still allow that way of adding buttons (without a command) and its CommandBarButton class provides the Click event, so it is quite easy. I have written an article to show this approach although it is not recommended for the reasons mentioned in the article:

HOWTO: Create a CommandBarButton without a command from a Visual Studio .NET add-in
http://www.mztools.com/articles/2011/MZ2011017.aspx

The only scenario where I have had to use this approach is in the Options window of my MZ-Tools add-in, which has controls such as listviews where I want to provide a context menu with the look and feel of the Visual Studio ones (see HOWTO: Create a context menu using a Visual Studio commandbar popup from an add-in), but I don’t want a command for the buttons of the context menu (they don’t make sense in that scenario).

As for custom pictures in buttons created with that approach, they are as difficult as usual ;-). The article provides a reference to this other article HOWTO: Creating custom pictures for Visual Studio .NET add-ins commands, buttons and toolwindows which has a section about “Custom pictures for add-in buttons without a command”.

MZ-Tools Articles Series: HOWTO: Create a context menu using a Visual Studio commandbar popup from an add-in

While I have written a lot of articles and posts about the commandbars of Visual Studio (the most popular is HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in), I hadn’t written about the following case yet, that I use extensively in my own MZ-Tools add-in and that was mentioned at the end of that article but no code sample was provided:

HOWTO: Create a context menu using a Visual Studio commandbar popup from an add-in
http://www.mztools.com/articles/2011/MZ2011015.aspx

VS SDK, packages, add-ins, macros and more…