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

  • Home
  • SEARCH
  • 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 381715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:06:44+00:00 2026-05-12T15:06:44+00:00

Env.: .NET / VS2008 Hi All, My app uses a 3rd party DLL assembly

  • 0

Env.: .NET / VS2008

Hi All,

My app uses a 3rd party DLL assembly separately installed on some systems (clearly identified) but not all of them.

Which means that on some systems, the DLL is not there hence must not be called. To solve this, I have 2 versions of the app (using 2 configurations) for the 2 use cases. In one of them, all calls to the DLL are #if’ed out.

Since there are no calls to the DLL compiled at all in the app(they’re #if’ed out), is it safe to assume that the app won’t try to load the DLL even though it is referenced?

Or should I also exclude the reference?

Note: Asked in reaction to womp’s comment in this question.

TIA,

  • 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-12T15:06:45+00:00Added an answer on May 12, 2026 at 3:06 pm

    IIRC, the C# compiler will omit references to dll’s that are never actually used in the code. So if all code is inside #ifs, the reference to the dll will not be there in your compiled app, and the dll will never be loaded.

    You can check this using Reflector, by the way. Just drag & drop your compiled app into Reflector, and look at the References node. ILDASM also provides this feature, I think.

    Caveat: DllImports and dynamic type loading (e.g., Type.GetType("type,dll")) will dynamically load dlls without the C# compiler knowing or caring. But again, if inside the proper #ifs, nothing will be loaded.

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

Sidebar

Related Questions

I have a third party .NET Assembly and a large Java application. I need
Env.: VS 2008, .NET 2.0, WinForms I have a listview in Tile mode. Some
Is it possible to set env vars in pom.xml that junit tests uses? Netbeans
Env: .NET 1.1 I got into this situation. Where I need to give a
My development env: Windows 7, TortoiseHg, ASP.NET 4.0/MVC3 Test branch: code on test server
Having some problems installing BlogEngine.NET onto my CentOS mod_mono 2.8 (mono 2.8.1) box. The
I'm in the process of doing some Java<->.NET interop code using a native library
We are developing an extension (in C# .NET env.) for a GIS application, which
My env is Visual Studio 2008 C# and .Net. I like to call an
I'm trying to call a Java Web Service from an MVC3 .NET web app

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.