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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:24:33+00:00 2026-05-29T04:24:33+00:00

I have a file named common.cs which contains commonly used functions like this public

  • 0

I have a file named common.cs which contains commonly used functions like this

    public int GetColumnIndexByNameTemplateField(GridViewRow row, string SearchColumnName)
{
    int columnIndex = 0;
    foreach (DataControlFieldCell cell in row.Cells)
    {
        if (cell.ContainingField is TemplateField)
        {
            if (((TemplateField)cell.ContainingField).HeaderText.Equals(SearchColumnName))
            {
                break;
            }
        }
        columnIndex++;
    }
    return columnIndex;
}

Now I want to make that common.cs file change into common.dll, I created another class library project in which I copied all the code from common.cs file, added necessary references and built it to generate dll file, now I pasted that dll file from project debug directory into the bin directory of my asp.net project which is already using common.cs but whenever I try to import that dll using.

[DllImport("common.dll")]
public static extern String NewString(String x);

where NewString is another function, I get this error.

Unable to find an entry point named ‘NewString’ in DLL ‘common.dll’.

I have checked already posted questions on stackoverflow as well as other guides on internet that tell how to make and use a dll but I don’t know why I am getting this error also most of the guides show dll written in C++ where as my dll is written in C#, they also tell to use __declspec(dllexport) which tells that function is ready to be exported or something like that but I can’t use this in C# dll I suppose.

I think its a basic question but this is my first time creating dll in C# so please help me out.

Thanks.

  • 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-29T04:24:34+00:00Added an answer on May 29, 2026 at 4:24 am

    Ahmed if you want to turn any project into a library (.dll), double click the ‘properties’ folder in the solution explorer. Click the drop-down for project type and select ‘Class Library’ then click build, rebuild solution to recompile into a .dll.

    Note that you can create a new ASP.NET project in the same solution by right clicking the solution and clicking ‘add project’. Or you can open a new instance of Visual Studio. Once you open the ASP.NET project right click on references and click add reference. Click the browse tab, navigate to the folder containing the .dll and add it. Don’t forget that any classes defined in the .dll must be marked as public or they will not be visible in other assemblies. Also don’t forget the using statements for the namespaces that your classes are defined in.

    When you click the ‘Run Button’ (the green arrow) it will always run the project that is in bold in the solution explorer. If a .dll is bolded then you will get an error that you cannot run a class library but you must instead change it to console application. If it is a console application then it must have a static void Main() function defined so it knows where to start. You can set any project as the startup project by right clicking it in solution explorer and click ‘set as startup project’.

    If you wish to run a program in your solution, but do not want to set it as the start up program than you can right click, go to debug and run. Organizing like-projects in a single solution can make maintaining them much easier.

    Hope this helps.

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

Sidebar

Related Questions

I have a file named common.h where all the variables and functions have been
I have a txt file named prob which contains: 6 2 8 3 4
I have a file named my file.pdf and I can't delete this file with
I have a file named configuration.xml which resides in classes folder of my WEB-INF
I have created a file named MyFile.db using SQLite3 from my C#.net application. This
I have a piece of content that is structured like this: Body Common Containable
I have a file,named f1.txt, whose contents are 75 15 85 35 60 50
I have a file named file with three lines: line one line two line
I have a JAR file named helloworld.jar . In order to run it, I'm
I have a jar file named umar.jar in /root/umar/bin directory. I have a shell

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.