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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:45:19+00:00 2026-05-18T00:45:19+00:00

I am making an application which is almost done but there is one thing

  • 0

I am making an application which is almost done but there is one thing that is bugging me. There are about 12-13 files that must be in the directory of the folder (some .dlls, some .xml files etc.) for the application to run, and I want to make my application as compact as possible, meaning I want as fewer files to go with the application. So my question is, how can I do this? Can all the files be included in the application itself? Is it necessary for the .dlls to be in the application folder or can I reference them from somewhere else? I was thinking to make a folder for all those files but I don’t think my application will run if a .dll file isn’t placed in the same directory as the application.

  • 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-18T00:45:19+00:00Added an answer on May 18, 2026 at 12:45 am

    How to embed and access resources by using Visual C# looks like just what you need.
    [edit]
    If you want to load DLLs, you can combine the above with the AppDomain.AssemblyResolve event SLaks mentions like this:

    using System.IO;
    using System.Reflection;
    
    namespace ConsoleApplication3
    {
      class Program
      {
        static void Main(string[] args)
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;
            currentDomain.AssemblyResolve += 
                    new ResolveEventHandler(MyResolveEventHandler);
            var myWrappedClass1 = 
                currentDomain.CreateInstance(
                        "ConsoleApplication3.ClassLibrary1.dll", 
                        "ClassLibrary1.Class1");
            var myClass1 = myWrappedClass1.Unwrap();
            Console.WriteLine(myClass1.GetType().InvokeMember(
                        "Add", 
                        BindingFlags.Default | BindingFlags.InvokeMethod, 
                        null,
                        myClass1, 
                        new object[] { 1, 1 }));
            Console.ReadLine();
        }
    
        private static Assembly MyResolveEventHandler(
                object sender, ResolveEventArgs args)
        {
            Assembly currentAssembly=null;
            Stream dllStream;
            try
            {
                currentAssembly = Assembly.GetExecutingAssembly();
                dllStream = 
                        currentAssembly.GetManifestResourceStream(args.Name);
                var length = (int)dllStream.Length;
                var dllByteArray = new byte[length];
                int bytesRead;
                int offset = 0;
                while ((bytesRead = dllStream.Read(
                                        dllByteArray, 
                                        offset, 
                                        dllByteArray.Length - offset)) 
                        > 0)
                    offset += bytesRead;
                return Assembly.Load(dllByteArray);
            }
            catch
            {
                Console.WriteLine("Error accessing resources!");
            }
            return null;
        }
      }
    }
    

    where Class1 is a class library containing just:

    namespace ClassLibrary1
    {
        public class Class1
        {
            public int Add(int x, int y)
            {
                return x + y;
            }
        }
    }
    

    and the DLL is added as an Embedded Resource to the file:

    alt text
    alt text

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

Sidebar

Related Questions

Background: I have an application which plays video files from disc. When I play
I am making an application which uses a dock tile plug-in. However, when I
I am making application in which i want to find the list of the
I am making an application which have to be used in different pc's, and
I am making an application which implements the following structure : MainWindow |_ tabBar
I am making an application which Streams media from the Internet,it can be from
I am making an application which will act as a virtual printer saving the
i am working on making bluetooth application which makes use of bluetooth api. i
I am working on a CMS that instead of generates pages automatically, it generates

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.