class reference not working in .NET 1.0 but ok in .NET 2

Hello,

I'm not sure if I'm doing something wrong, but hopefully someone can help me figure it out.

I created a very simple class library project, compiled it (no problems here). I then added a reference to it from the website project. Visual Studio sees it and I can use the class in my website project. When I try viewing the website project in the browser, I get the "are you missing a using directive or an assembly reference?" error. I've placed the DLL file in the bin folder off the webroot. The weird thing is that when I enable .NET 2.0 for the site, it runs fine and does it's thing as expected.

Is there differences between .NET 1.0 and 2.0 when using DLL files? I'm using Visual Studio 2005 to create and compile the class library.

Thanks,

Daniel

 

0
danny99
6/10/2008 12:47:26 AM
asp.net.getting-started 91979 articles. 4 followers. Follow

9 Replies
941 Views

Similar Articles

[PageSpeed] 30

maybe u forgot the "using" directive (Import in VB)


if this post unswerd ur question marke it as answer
0
yassir
6/10/2008 1:00:03 AM

Hi Daniel,

Somebody correct me if i'm wrong. I believe there are changes on constructing .net 2.0 class library, such as partial class. This is just a small insight, you can always go to msdn to thoroughly search on this issue.

Happy coding.


Please don't forget to click "Answer" if it helps you as it may help others also.
0
jobejufranz
6/10/2008 1:02:40 AM

Hmm... I tried searching MSDN but I'm not even sure where to start.

I'm pretty new to ASP.NET. For my client, I've been doing small things here and there using a single code behind file. But now that things are revamping up, I thought it be better to start using components to separate things. I'm coding in C#.

Maybe if will help if I post some code snippets.

This is the class file:

using System;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;

namespace Company.Pictures
{
    public class Album
    {
        public string Testing()
        {
            return "Company.Pictures.Album.Testing() called!";
        }
    }
}

This is the code behind that's calling it:

using Company.Pictures;

namespace CompanyTest.Demo
{
    public class test3 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Album test = new Album();
            Response.Write(test.Testing());
        }
    }
}

Thanks,

Daniel
 

0
danny99
6/10/2008 2:05:09 AM

I hate to bump this... but am I doing anything wrong in my code? I'm trying to run this in .NET 1.0. I unfortunately can't dev for .NET 2 or higher because the client does not want to update the framework. It works just fine when I'm running it in .NET 2. Am I creating the class incorrectly for .NET 1?

Thanks for any help.
 

0
danny99
6/10/2008 7:07:22 PM

 Did you actually add a reference to this DLL in your project through right clicking on "references" in your Solution Explorer ----> Add Reference ---> Browse tab ---> find your dll  file and press ok...

 


Alexei Fimine
_____________
Don't forget to mark this post as "Answer" if it indeed answered.
0
fimine
6/10/2008 7:16:59 PM

 I don't have hard evidence on this, but I don't think you can develop 1.1 on VS 2005 unless you do something really weird to your build process (read about it somewhere but I don't remember where). 

VS 2005 is targetting 2.0 framework only.  If you need to develop 1.1 stuffs (I am not sure about 1.0 hehehe), use VS 2003. I guess VS.NET for 1.0.

Even the new VS2008 can't target 1.x framework.

This might be the issue, but again I have no hard evidence.

You might want to download 1.0 or 1.1 SDK and compile it in consle using that.  See if that work.


Jimmy Chandra
Blogging at Incoherent Rambling

Mark this post as Answer if you think it helped you solve the problem.

0
jchandra
6/10/2008 7:27:18 PM

Thanks Jimmy. I'll try that. 

0
danny99
6/10/2008 10:19:07 PM

Hey Jimmy, thanks again for your help. I compiled the class with the 1.1 framework and it works! But I can easily see this becoming a drag to always compile in the console. Do you know if it's possible to have VS2003 and VS2005 installed side by side?

Quick question, how do I compile multiple class files? Do I just append them like: /out:compiledfile.dll class1.cs class2.cs etc..?

Thanks.

Update: Actually I guess I could write the compile script into a bat file. 

0
danny99
6/10/2008 10:36:09 PM

 Yes, it is possible to have all VS 2003 / VS 2005 / VS 2008 to be installed side-by-side.  Although I don't think it's a good idea to do so with VS 2005 & VS 2008 (unless there is a very good reason like K2 BlackPearl which requires specific version of VS) since VS 2008 can target 2.0 framework.  It will just be redundant, but if you are doing .NET 1.x development, unfortunately you will need VS 2003 still.  Either side by side or install it in a virtual machine. 

I guess you found your answer for the second question :)

 


Jimmy Chandra
Blogging at Incoherent Rambling

Mark this post as Answer if you think it helped you solve the problem.

0
jchandra
6/11/2008 2:37:31 AM
Reply:

Web resources about - class reference not working in .NET 1.0 but ok in .NET 2 - asp.net.getting-started

Wikipedia talk:Reference desk/Guidelines/Medical advice - Wikipedia, the free encyclopedia
I disagree with this implication that this section of the guideline represents the consensus. If you look at the last few years of discussion ...

Child sex abuse royal commission: Senior politician to be grilled over reference
A former deputy Premier will again take the stand on Tuesday to explain why he gave a positive job reference to a man he knew to have sexually ...

Reference Pricing tweak for Medicaid
Reference pricing is a common payment reform for commercial insurance. Common, non-urgent, deferrable procedures are prime candidates. Hip replacement ...

10 of the best movie references you’ll ever see in popular TV shows
I'm torn when it comes to breaking the fourth wall in TV shows . It can be a fun, clever way to connect with the audience, but it can also break ...

'Enough with the Viagra references,' says the CEO behind the first FDA approved drug to boost women's ...
... the Fortune Most Powerful Women Next Gen conference. But the reaction to the pill still confounded her. "Enough already with the Viagra references," ...

Donald Trump prompts Nazi references
Some conservatives and political commentators say the GOP frontrunner's rhetoric has crossed the line

Arrow: Easter Eggs and DC Comics References in "Brotherhood"
This was a weird week for Arrow, in terms of the crazy minutia we generally look for.There were a [...]

Now you can bookmark Google image searches for later reference
Normally, image searches on Google are ephemeral things and gone the moment you close the browser tab. However, a new feature on the search giant's ...

The 5 Best Britney Spears References From Her 'Jane the Virgin' Visit
The 5 Best Britney Spears References From Her 'Jane the Virgin' Visit

How To Get the References You Need For the Job You Really Want
How To Get the References You Need For the Job You Really Want

Resources last updated: 12/12/2015 9:29:11 PM