Error while switching Word 2010 Add-in to .NET 4.5

Asked By 10 points N/A Posted on -
qa-featured

Hi,

 

I am using VS2012 to create Office 2010 Add-Ins which are targeted to the .NET 4.0 framework by default. Most of the new "controls" dll for TFC2012 target the .NET 4.5 Framework.  When I tried switching Word 2010 Add-in to .NET 4.5 I encountered this error

 

Attempted re-targeting of the project has been canceled. The .NET Framework version you selected is not supported by this project type.

OK

The framework of the Add-in is reset back to .NET 4.0 and when tried to add references I only had the option to select the .NET 4.0 files, this do to have any of the .Controls dll's and all the UI controls I need to use are located here.

I tried editing the project file directly by manually setting the v4.5 framework in the .csproj file, which allows me to bypass the error message and have the v4.5 framework selected on the project properties page. The .NET 4.5 assemblies allow for adding of references. Building and compiling the project was now smooth but encountered this error when I tried to debug and the Add-in was not able to load.

 

The common language runtime could not be loaded by file://c:/users/jbuys/documents/vidual studio 2012/projects/WordAddin1/WordAddin1/bin/Debug/WordAddin1.vsto|vstolocal.

Contact your administrator for further assistance.

OK

The common language runtime could not be loaded by file://c:/users/jbuys/documents/vidual studio 2012/projects/WordAddin1/WordAddin1/bin/Debug/WordAddin1.vsto|vstolocal.

Contact your administrator for further assistance.

I however built an installer for the application and install it and the Add-in was perfectly loaded and I was able to use the new features of 4.5.

My question now is: Is there a shim layer that is used when launching an office Add-in from VS2012 that hardcodes the .Net framework to 4.0?  If so is there a way to modify that layer and force it to .NET 4.5?  How else can TFS2012 Add-ins be built for office applications that can use all the TFC assemblies?

Thank you very much.

SHARE
Answered By 0 points N/A #199019

Error while switching Word 2010 Add-in to .NET 4.5

qa-featured

Dear Hannahwtc,
Hope you are well.
To fix this situation you should update your Office package with the recent versions to be complied with .Net 4 which requires specific updates. You will find them in the Important tab in your Update Wizard.
After the updates you can use add-ons without conflict.
Hope this was helpful for you.
Best wishes,
Don Muench

Related Questions