How to fix “The operation could not be completed” error adding references to Visual Studio 2017

The Issue

Using Visual Studio 2017 and attempting to add a reference to a project you receive an error stating “The operation could not be completed”.

cameron-dwyer-vs2017-add-reference-error-01-add-reference

cameron-dwyer-vs2017-add-reference-error-02-operation-could-not-complete

The Solution

It seems that to bring up the Add Reference dialog in Visual Studio 2017 the Microsoft.VisualStudio.Shell.Interop.11.0.dll needs to be regsitered in the GAC. You can follow these steps to register this assembly in the GAC:

Open the Develop Command Prompt for VS2017 (ensure you run the as administrator otherwise the GAC registration may fail)

cameron-dwyer-vs2017-add-reference-error-03-dev-command-prompt-as-admin

Change the current directory to the PublicAssemblies folder for your Visual Studio 2017 installation. Mine was:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies

Note: this path will be different for different versions of Visual Studio (e.g. you may find your path is C:\Program Files\Microsoft Visual Studio\2017\Community\Common7\IDE\PublicAssemblies)

cameron-dwyer-vs2017-add-reference-error-04-public-assemblies

Run the following command to register the assembly in the GAC:

gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll

cameron-dwyer-vs2017-add-reference-error-05-add-to-gac

Now restart VS2017 and try to add a reference to your project again and you should see the Add Reference dialog appear.

cameron-dwyer-vs2017-add-reference-error-06-add-reference-dialog-working

15 thoughts on “How to fix “The operation could not be completed” error adding references to Visual Studio 2017

Add yours

  1. I m getting the below ERROR.

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Privat
    eAssemblies>gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
    Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
    Copyright (c) Microsoft Corporation. All rights reserved.

    Failure adding assembly to the cache: The system cannot find the file specifie
    d.

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑