Click here to Skip to main content
15,846,144 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a console application in C# to access databases.
Later, I changed the output type to Class Library.
the framework is set to .NET framework 4.

I have crated a ASP.NET Empty Website project.
I want to add my dll reference to this.

Things I've tried:
1. Right click project and add reference --> browse to C# project location --> add .dll file from bin/debug folder

--The above does not work

2. I've tried to add the .dll file from original location directly in root project folder of ASP.NET website, and then add a reference to this copy of the .dll file.
-- What this does is creates a copy under Bin folder
--This also doesn't work.

When I say it doesn't work, I'm trying to add a Using reference in the ASP.NET website. The default.aspx.cs page, does not have any namespace (by default).
Also, I've checked that .NET framework for ASP.NET website is set to .NET 4 (not .NET 4 client).

Can anyone please suggest what might be going wrong? your help and ideas will be greatly appreciated.

P.S. The .pdb file, which gets added when you add the .dll file in Bin folder, has a RedDot on the icon. Suggesting it might be some sort of an error. When i complied the original .cs file, of the class library, no errors were found. Also, no main class exists in original C# project, since it is a class library.
Updated 20-Dec-11 12:12pm

I think the .dll Assembly might have been corrupted.

I created another Windows --> "Class Library" project. Added "Existing Items" from old project.

Created a sample ASP.NET Empty Website. Imported .dll again, by just adding reference. Again the .dll file was brought in. Also, .pdb file still has the red dot on it's icon. But the .dll showed up successfully this time when typing : using <myImportedDllFile>;

This issue is solved, but i don't know how. If anyone else faces this problem. They can try the same approach. Create new library with old files, and try importing the new library in a test project. Since now it works, i can use it in my production import.
Share this answer
Monjurul Habib 20-Dec-11 15:54pm    
El H 1-Aug-21 15:41pm    
I'm having the same problem, I can't see the refernces I added.

Please help
When you say "The default.aspx.cs page, does not have any namespace (by default)", do you mean the assembly you have referenced does not have a using statement, such as
using System;
using System.Collection;

If this is case, then no, just by adding a reference using statements are not automatically added to the files, you must do that manually.
Share this answer
robroysd 20-Dec-11 12:49pm    
the default.aspx.cs has other Using references, which are there when you create the page: example -- Sys.colllections.generic, Sys.Web, Sys.Web.UI.

What i meant to say was, The default.aspx.cs page, is not structured within a namespace ; as in .. using clases.. Namespace Something { public partial class..}. I'm sure it is of no consequence to the .dll file being added. I was trying to say, the .dll file (and its original class) has a namespace specified.
Member 9856776 4-Mar-13 10:34am    
Error 1 The type 'DataGridControls.CheckBoxColumn' exists in both 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\website15\4e638e30\fd083711\App_Code.cl0q7pqb.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\website15\4e638e30\fd083711\assembly\dl3\18c60ea7\0084a29b_8926c301\DataGridCheckbox.DLL' c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\website15\4e638e30\fd083711\App_Web_buegnifi.4.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900