Missing interop.*.dll

  • Thread starter Anders Eriksson
  • Start date

A

Anders Eriksson

I have a solution that I have created in VS2008 and is now moving to VS2010

I have a reference to a COM Server, and exe file.

In VS2008 there has always been a interop.<filename>.dll created in the
bin directory.

For VS2010 there isn't!

Is this some error or has VS2010 done away with these interop..dll?

// Anders
 
Ad

Advertisements

J

James A. Fortune

That said, yes…VS2010/C# 4/.NET 4 has a number of new features intended
to make dealing with COM interop easier.  Among those is the "no Primary
Interop Assembly (PIA)" feature, in which the compiler takes the type
information from the COM interop assembly, and instead of requiring you
to deploy the whole interop assembly, embeds the types you use in your
program within your program's own assembly.

You can control this behavior using the "Embed Interop Types" property
for a COM interop reference added to your project.

There are a number of other enhancements to use of COM interop as of the
VS2010 release, such as the dynamic type (which allows type resolution
to be deferred until runtime), and "type equivalence" (which allows two
managed assemblies to use different versions of interop DLLs and yet
still work together in the same process), among others.

In general, you should find dealing with COM interop much easier in many
ways with .NET 4/C# 4 than with earlier versions of .NET and C#.

It was interesting how that mini-advertisement creeped in :). It's
nice that a dependency on the DLL is no longer required when that
property is checked. It's also nice that only the interop parts that
actually get used get embedded in the project. But as nice as that
capability is, it doesn't impress me a lot. I realize that
Microsoft's motivation for interop is a response to companies with
many, many lines of code that will take a lot of time and effort to
convert over to managed code. I.e., they weren't even trying to
impress me :). But as someone who needs to find ways to use interop
more than the average C# programmer, that feature is almost as
underwhelming for me as the hoopla over optional parameters. Don't
get me wrong. Microsoft has provided a large variety of ways for me
to do what I need to do in C#, especially in terms of threading and
interop options. So many, in fact, that choosing the best ones will
not be an easy task. I even learned yet another new threading option
today. In the PDC 08 session:

TL 13 - Microsoft Visual C++: 10 is the new 6 (Boris Jabes)

"It [lambda expression] is simply a functor done for you
automatically.
...
Where I think they're really interesting to experience is when you're
doing parallel programming where parallel API's really take advantage
of the fact that you can quickly express functionality and state in
one place and then pass it around on any number of cores.
...
The building block for all of these [API's, agents, tasks, algorithms]
is lambdas. So probably you're going to start seeing this as a kind
of a required knowledge to build parallel applications, in C++ anyway,
and probably in other languages as well."

Until now, I had thought of lambdas mostly as a vehicle for
implementing LINQ without much consideration of what future
possibilities they will enable for me. So I suppose that Microsoft's
touting of features that are somewhat marginal to me is fine as long
as the features I really care about are there. I have to recurse
(made up verb) finding the best ways of doing interop with
understanding how I can use the new features before I decide how
important they are to me :). Type equivalence looks great if I opt
to use managed C++ to take advantage of C++'s special interop
capabilities. I'll already know the data types that are to be
"marshalled," so the dynamic type's main benefit seems to be that
hinted in the PDC 08 session:

TL11 - Introduction to Microsoft F#

where map and sum are changed to pmap and psum in a declarative way to
transition smoothly to running in parallel. The kind of thinking
required to program in F# is a little foreign to me, so I'll have to
try it out a little to see if it's as appealing to mathematicians as
they claim.

James A. Fortune
(e-mail address removed)
 
A

Anders Eriksson

Does your program still work? If so, that's a pretty good indication
there is no error. :)
No, I have one event handler that doesn't work.Everything else works.
I will try with Embed Interop Types = false.

Thank you!

// Anders
 
A

Anders Eriksson

Unless that one event handler is your own program's only contact with
the COM server, then I don't think the problem with your event handler
is likely to have anything to do with interop type embedding. The type
embedding is going to be an either/or thing; barring a compiler bug, if
any of the COM-using code is working, then the interop types got
embedded properly.
No,it's not the only contact with the COM server. I have several other
event handlers which work.
Of course, you're not specific about what "doesn't work" means and how
your event handler relates to the COM server in question. It's likely
those details may also rule out an interop type problem as well, in and
of themselves.
By "not work" I meant that I never get the event! The event is from a
axis that when it's has reached it new position should raise this event.

I have now tried with Embed Interop Types = false
and everything works!

It does seems like this perticular event isn't embeded...

Thank you for your help!

// Anders
 
Ad

Advertisements

A

Anders Eriksson

You can use the program ILDASM.EXE to inspect the assembly. You'll be
able to see the interop type(s) that are embedded in your program, to
see if the event is in fact embedded or not.

I have now used ILDASM.EXE and inspected the assembly. You were rigth
the event hander for Reach Position is embeded in the dll. Strangely
that is works when I use Iterop.laserengine.dll but not when it's embeded.

I don't have any objections about using an extra dll so I will go for that.

Thank you for all your help!

// Anders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top