What is the difference in the settings for Embed Interop types true and false in Visual Studio?

In Visual Studio, when adding one link to a project, the properties window has an Embed Inteop Types option, should it be set to True or False ? What's the difference?

Since we have many projects, among some of them the link was set to False , others were set to True , this is completely a mess. And the bulid server also has the same warnings:

What does the link to the built-in interop assembly mean? <? >

So, we plan to change all Embed Inteop Types to False , what risk do we get?

+76
c # visual-studio
Dec 11 '13 at 8:35
source share
2 answers

This option was introduced in order to remove the need to deploy very large PIAs (primary assembly assemblies) for interoperability.

It just uses managed bridge code, which allows you to talk to unmanaged assemblies, but instead of injecting it, it only creates the material that you actually use in the code.

Read more in Scott Hanselman's post about this and other VS enhancements here .

As to whether it is recommended or not, I am not sure, since I do not need to use this function. A quick search on the Internet gives several results:

The only risk of turning them all false is more problems installing PIA files and larger deployments if some of these files are large.

+50
Dec 11 '13 at 9:29
source share

I noticed that when it is set to false, I can see the value of the element using the debugger. When it was set to true, I received an error message - item.FullName.GetValue. The nested interaction type "FullName" does not contain a definition for "QBFC11Lib.IItemInventoryRet" because it was not used in the compiled assembly. Consider distinguishing an object or changing the Insert Intrusion Type property to true.

+5
Jan 05 '16 at 18:05
source share



All Articles