Upgrading VSTO project to .net 4 - What references do I actually need?
I'm developing an application for Office. It originally targeted .net 3.5, but I decided to upgrade to .net 4 because of some WPF issues that I've run into.
When I switched all the projects in my solution and rebuilt, I got an error saying to include System.Xaml. I did that and rebuilt, and VS2010 told me to include another reference, so I did. This happened a couple more times, and finally it asked me to include Microsoft.Office.Tools.Common.v9.0, and when I did I got this error:
Microsoft.Office.Tools.CustomTaskPaneCollection exists in both Microsoft.Office.Tools.Common.v9.0.dll and Microsoft.Office.Tools.Common.dll
I have both Microsoft.Office.Tools.Common.v9.0 and Microsoft.Office.Tool开发者_C百科s.Common referenced in my project, but the problem is that if I remove either, I get an error. Am I doing something wrong? Is it odd that I would need both references? I find it strange that CustomTaskPaneCollection would be defined in two different binaries.
If I remove Microsoft.Office.Tools.Common, the error that I get is "Cannot find the interop type that matches the embedded interop type 'Microsoft.Office.Tools.IAddInExtension'. Are you missing an assembly reference?"
'Microsoft.Office.Tools.IAddInExtension' is part of Microsoft.Office.Tools.Common.dll only. So removing Microsoft.Office.Tools.Common.v9.0 should not be a problem. However, if any of your referenced or involved project has Microsoft.Office.Tools.Common.v9.0 added in it, you need to change it to Microsoft.Office.Tools.Common.dll. Once you do that, it should solve your problem. The baseline is, all the projects/referenced dlls needs to be recompiled after changing the target platform to 4.0 if any of them are using the VSTO dlls.
Hope that helps.
精彩评论