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 938999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:43:14+00:00 2026-05-15T21:43:14+00:00

I have a C# project with a UserControl in it. This user control depends

  • 0

I have a C# project with a UserControl in it.

This user control depends on a particular C++ Mixed mode dll which in turns, acts as a facade to an unmanaged C++ DLL

                     C#           C++ Mixed            C++ Umnanaged
  [ main app ] ---> [ myUC ] ---> [ OCShell.dll ] ---> [ OCC.dll ]

In the Design View, I cannot add the UserControl. It says that there is a FileNotFoundException on OCShell (or one of its dependency). However, via code, everything works fine. In main app (windows form) I can

myUC uc = new myUC();
this.Controls.Add(uc);

and this works fine. The right code gets executed properly.

I checked with Dependency Walker and everything is ok. Everything gets properly copied to the Bin\Debug\ directory and each of those DLL sees each other.

My guess is that the Design View Editor does not check the proper paths for those DLL and thus returns an error.

I also tried copying every dll to every possible directory in my solution but that didn’t help either

  • 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-15T21:43:14+00:00Added an answer on May 15, 2026 at 9:43 pm

    Yes, that’s a problem. At issue is that the code is executing in Visual Studio, not your app. The probing path that’s used to find dependent assemblies will only include private directories of VS (Common7\IDE\PrivateAssemblies and PublicAssemblies), not the build directory of your project. You can make it find OCShell.dll by copying it into one of those directories, but the unmanaged DLL is going to have to be put in a directory that Window will search when looking for DLLs. Which, other than the Windows side-by-side cache which requires a manifest, is limited to a directory on the system PATH environment variable.

    These are not pleasant options. The best thing to do is to ensure that the code in these DLLs cannot execute at design time. You do so by using the DesignMode property, bypass calls if it is True. That needs to be done in at least the constructor and the Load event. Other events can run as well. Also greatly minimizes the odds that you’ll crash Visual Studio because of a bug in the unmanaged code. If this impacts the design-time view of the control then you may need to write a designer to make up for that.

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

Sidebar

Related Questions

I have a PictureBox as UserControl . I added this User Control on the
I am using an ASP.Net Web Application project. I have a user control which
In a Visual Studio website, I have created a user control. This control is
This might be abit out there, but here goes: I have a User Control.
I have created a C# user control which I want to use in VB.NET
I have a winforms app that uses a UserControl. The user control's job is
I've made a simple project to illustrate my problem. I have a user control
I have a C++ 'Control Library Project' compiled using /CLR. Inside this project there
Working on a project with a setup like this: ASPX Page User Control 1
within my current project file I have a user control that has a storyboard

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.