Ksuvec
Ksuvec

Reputation: 483

Visual Studio 2017 enterprise can not add reference

When I want to add a reference in a project in Visual Studio 2017 Enterprise. I get the following error:

"The operation could not be completed"

I have tried cleaning and rebuilding solution, restart computer, delete bin and obj folder and all .suo files. Also there is no error in my Web.config file.

Upvotes: 10

Views: 9134

Answers (2)

Bharat Bansal
Bharat Bansal

Reputation: 1

I have tried the below steps and it worked for me.

  1. Select the project in which you want to add the reference, then right click on it, Unload the project.

  2. Again go to the same project, right click and then you can see the option of Edit the project. Click on it and for reference click on this link- Project_Name.csproj file(C#)

  3. Now manually include the namespaces or any project reference present in the same solution which you want to use in the current project. For reference, click on this link- Add the references:See Highlighted

  4. In order to create the Project UID(Unique ID)- {1140F306-2341-4D3D-BEC7-9CCA3C2AC00E}, Go to Tools -- Create GUID -- Select GUID Format i.e. Registry Format and then click on copy and then paste it into your .csproj file. For reference click on this link- GUID Tool

  5. Then save the .csproj file and then right click on the project in which you have done changes and Reload the project.

  6. After following the above steps, right click on the references and you can see the namespace or project reference which you have given in .csproj file

I hope, the above solution will work for others as well.

Upvotes: 0

Ksuvec
Ksuvec

Reputation: 483

So I got help from microsoft support.

  1. Open Visual Studio Command Prompt as administrator
  2. Goto the path of your visual studio installation, standard is: C:\Program Files (x86)\Microsoft Visual Studio\2017\
  3. Select your installation type and goto \Common7\IDE\PublicAssemblies
  4. Run command: gacutil -if Microsoft.VisualStudio.Shell.Interop.8.0.dll
  5. Run command gacutil -if Microsoft.VisualStudio.Shell.Interop.11.0.dll

This fixed it for me

Upvotes: 26

Related Questions