Assemblies not loading in office add-in with .net 4

175 views Asked by At

When I upgrade my add-in project from .net 3.5 to 4.0 I get this error in FusLog when it wants to load my add-in assembly:

Error extracting manifest import from file (hr = 0x8013101b).

I also add this to office exe config file (visio.exe.config in my case) but nothing changed.

<configuration>
    <startup>
        <supportedRuntime version="v4.0"/>
    </startup>
</configuration>
2

There are 2 answers

5
Eugene Astafiev On

Are you able to reproduce the issue with a newly created add-in if the target framework is set to .net 4.0?

It looks like one of your dependencies cannot be loaded (i.e. the .net 4.0 runtime is not supported).

P.S. When we talk about .net 4.0 - the full edition of the .net framework is considered (not the Client Profile).

0
DaNeSh On

Finally I find the answer: I should add useLegacyV2RuntimeActivationPolicy="true" as a startup attribute of the config file. so I should set the visio.exe.config to :

 <configuration>
 <startup useLegacyV2RuntimeActivationPolicy="true">
   <supportedRuntime version="4.0" sku=".NETFramework,Version=v4.0" />
 </startup>
 </configuration>