Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6126943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:26:29+00:00 2026-05-23T16:26:29+00:00

I have a COM assembly (let’s call it com1.dll) that I’m referencing in some

  • 0

I have a COM assembly (let’s call it com1.dll) that I’m referencing in some C# code. When I Add Reference I see an Interop.com1.dll in under the References node. If I execute the application from Visual Studio, the following code will run fine.

public void DoStuff()
{
    var customer = new com1.Customer();
    customer.DoSomething();
}

I then run my build script, executing the following nAnt:

<tlbimp output="Interop.com1.dll" typelib="com1.dll" namespace="com1"/>

and

<csc output="myapp.exe" target="winexe" debug="true">
    <sources>
        ...
    </sources>
    <references>
        <include name="Interop.com1.dll"/>
        ...
    </references>
</csc>

When I execute the assembly generated from the build script it will error on the var customer = new com1.Customer(); line of code with the following stack trace:

System.Runtime.Serialization.SerializationException: The input stream is not a valid binary format. The starting contents (in bytes) are: 44-65-76-45-78-70-72-65-73-73-2E-58-74-72-61-45-64 ...
   at System.Runtime.Serialization.Formatters.Binary.SerializationHeaderRecord.Read(__BinaryParser input)
   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadSerializationHeaderRecord()
   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
   at System.ComponentModel.Design.DesigntimeLicenseContextSerializer.Deserialize(Stream o, String cryptoKey, RuntimeLicenseContext context)
   at System.ComponentModel.Design.RuntimeLicenseContext.GetSavedLicenseKey(Type type, Assembly resourceAssembly)
   at System.ComponentModel.LicenseManager.LicenseInteropHelper.GetCurrentContextInfo(Int32& fDesignTime, IntPtr& bstrKey, RuntimeTypeHandle rth)
   at MyApp.MyClass.DoStuff()

My question is does anyone know why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:26:30+00:00Added an answer on May 23, 2026 at 4:26 pm

    I figured this out. Turns out the application has a <project>\Properties\Licenses.licx file. When building the application from NAnt we were including that file in the <csc><resources/></csc> block. For some reason this worked until I added the interop references.

    What I needed to be doing was creating a license file from the licx using the NAnt <license/> task. The output from that task replaced the <project>\Properties\LIcenses.licx file in the <csc><resources/></csc> portion of the build script.

    And with that, Bob truly was my uncle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some Javascript code that will programmatically register an COM interop assembly by
I have a project that references a COM dll, and the Interop assembly is
I have a COM-Callable Wrapper on a .NET assembly. Some of the methods use
I have trouble to expose a .NET assembly in COM. It seems that I
I have an assembly that is exposed to com that provides access to a
I have a c# .NET assembly that gets called from a C++ COM client.
I have a .NET v2.0 Dll that exposes a few classes to COM. The
I have an WPF Full Tust explorer application that uses a COM assembly. In
I have an SSIS Package that utilizes a COM Interop (Interop.RFCOMAPILib.dll) around RightFax's COM
I have a COM Interop DLL that I'm automatically generating from an existing COM

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.