I have a VSTO-addin, which uses CustomTaskPanes. My code compiles and works fine, but problem comes from code analizers, like Resharper and Code contracts for .net.
This code provokes error messages from both analizers:
CustomTaskPane taskPane = CustomTaskPanes.Add(new UserControl(), "Title");
taskPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionFloating;
Cannot convert source type 'Microsoft.Office.Core.MsoCTPDockPosition [office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c]' to target type 'Microsoft.Office.Core.MsoCTPDockPosition [Microsoft.Office.Tools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]'
That is weird, because public type Microsoft.Office.Core.MsoCTPDockPosition exists only in office.dll. Anyway, I tried to resolve it using aliases and named Microsoft.Office.Tools.Common as Tools_Common:
extern alias Tools_Common;
using System;
using System.Windows.Forms;
using Microsoft.Office.Core;
using Tools_Common::Microsoft.Office.Tools;
using CustomTaskPane = Tools_Common::Microsoft.Office.Tools.CustomTaskPane;
But it didn't help at all. What is the cause of the message? How can I solve it (especially for code contracts)?
Also, I found another strange artifact - Resharper's autocomplete shows MsoCTPDockPosition like it exists in Microsoft.Office.Tools.Common.dll, but then I try to do autocomplete, it uses office.dll version: