Monthly Archives: May 2017

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

How to compare the MAPI property differences between Outlook emails

I was recently working on extracting mail from Outlook to an .msg file and later importing the .msg file back into Outlook. I was concerned that some of the non-obvious properties (there are a lot of non-visible MAPI properties stored on an email) would not be persisted or may change value in the process of the export/import. I thought this was going to be a daunting and time consuming process comparing the value of around 100 MAPI properties and playing spot the difference. Luckily the first thing I tried was the awesome OutlookSpy tool which I’ve found simply brilliant for assisting with Outlook development over the years. What I didn’t realise was that OutlookSpy has a build-in compare feature that will compare the MAPI properties of 2 mail items and highlight:

  • Properties missing/extra on the 2 objects being compared
  • Properties with different values on the on the 2 objects being compared
  • Properties with the same values on the on the 2 objects being compared

 

Steps compare the properties on 2 email messages using OutlookSpy

 

Select one of the emails to compare and select OutlookSpy | IMessage

cameron-dwyer-outlookspy-compare-01-IMessage

 

The IMessage window will appear showing all the MAPI properties on the item. From here select the Compare tab.

cameron-dwyer-outlookspy-compare-02-IMessageWindow

 

In order to compare this email against another email, the compare tab gives you a green area where you can drag and drop the PR_ENTRYID property from a different email message. So to do this leave the IMEssage window open on the compare tab.

cameron-dwyer-outlookspy-compare-03-CompareTab

 

Go and select the email you want to compare to in Outlook and select the OutlookSpy | IMessage button for this new email. You will be presented with the IMessage window and shown the MAPI properties for the new email. Locate the PR_ENTRYID MAPI property in the table (hint: click the column header to sort the table). Now drag and drop the PR_ENTRYID row from the table into the green drag/drop zone on the original IMessage window that you left open.

cameron-dwyer-outlookspy-compare-04-dragdrop-pr-entryid

 

Now the magic happens! The compare tab does a comparison of the 2 items and allows you to switch between properties with the same values, properties with different values, and missing or extra properties.

cameron-dwyer-outlookspy-compare-05-properties-same-on-both-email

 

cameron-dwyer-outlookspy-compare-06-properties-different-on-email

%d bloggers like this: