Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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.
Posted 20-Dec-11 7:14am
Edited 20-Dec-11 12:12pm
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Comments
Monjurul Habib at 20-Dec-11 15:54pm
   
5!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
robroysd at 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 at 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.
 

HOW SOLVE THIS ERROR PLEAS REPLAY

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 520
1 Mathew Soji 335
2 BillWoodruff 260
3 OriginalGriff 215
4 Afzaal Ahmad Zeeshan 188
0 OriginalGriff 6,168
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,028
3 Manas Bhardwaj 4,539
4 Maciej Los 3,845


Advertise | Privacy | Mobile
Web04 | 2.8.1411019.1 | Last Updated 20 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100