using Team Studio 2005
1. Create a new web site
2. Add a new class to the project
3. In the Page_Load handler of default.aspx.cxs, create a reference to the
new class
4. compile solution
Result: The type or namespace name 'TestClass' could not be found (are you
missing a using directive or an assembly reference?)
For example, here's my default.aspx.cs:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TestClass tc = new q();
}
}
here's the class I created:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for TestClass
/// </summary>
public class TestClass
{
public TestClass()
{
}
}
I duplicated the same behavior using VB.NET.
In Visual Studio 2003, the above code compiled, in 2005, it does not. Why
not?
Thanks. 18 1611
HI Roy
Which error message did you recieve on that code?
Sorry Roy - I didn't read that carefully enough
For my opinion you have to write:
TestClass tc = new TestClass();
Your code: TestClass tc = new q();
is not valid - how can the compiler know what this 'q()' is - even we
can not :)
Hope this helps
Roland
Roy,
Make sure that the page class and your class are in the same namespace
--
Stoitcho Goutsev (100) [C# MVP]
"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:15**********************************@microsof t.com... using Team Studio 2005 1. Create a new web site 2. Add a new class to the project 3. In the Page_Load handler of default.aspx.cxs, create a reference to the new class 4. compile solution Result: The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?)
For example, here's my default.aspx.cs: using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { TestClass tc = new q(); } }
here's the class I created: using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
/// <summary> /// Summary description for TestClass /// </summary> public class TestClass { public TestClass() { } }
I duplicated the same behavior using VB.NET.
In Visual Studio 2003, the above code compiled, in 2005, it does not. Why not?
Thanks.
what is new q()? Is q a class. Maybe you meant new TestClass() instead
of new q() like Roland suggested.
A portion of the sample code was pasted incorrectly. The Page_Load method
should be:
protected void Page_Load(object sender, EventArgs e)
{
TestClass tc = new TestClass();
}
> Which error message did you recieve on that code?
In file default.aspx.cs:
"The type or namespace name 'TestClass' could not be found (are you missing
a using directive or an assembly reference?)"
This must be a typo (I hope):
TestClass tc = new q();
new q()? What class is that? It's not evident from the context of your post.
Otherwise, have you tried adding the test class to your APP_CODE Folder?
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Roy" wrote: using Team Studio 2005 1. Create a new web site 2. Add a new class to the project 3. In the Page_Load handler of default.aspx.cxs, create a reference to the new class 4. compile solution Result: The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?)
For example, here's my default.aspx.cs: using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { TestClass tc = new q(); } }
here's the class I created: using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
/// <summary> /// Summary description for TestClass /// </summary> public class TestClass { public TestClass() { } }
I duplicated the same behavior using VB.NET.
In Visual Studio 2003, the above code compiled, in 2005, it does not. Why not?
Thanks.
> Otherwise, have you tried adding the test class to your APP_CODE Folder?
Yes, I have...and it works great. The problem is that I don't want to place
the code in the APP_CODE folder. I want to place code where it logically
makes sense.
Has Microsoft restricted where I can place code?
Thanks!
The compiler has to be able to find it. Either put it in a separate
assembly and use a reference, or put it in the APP_CODE folder.
--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:DB**********************************@microsof t.com... Otherwise, have you tried adding the test class to your APP_CODE Folder? Yes, I have...and it works great. The problem is that I don't want to
place the code in the APP_CODE folder. I want to place code where it logically makes sense.
Has Microsoft restricted where I can place code?
Thanks!
"q" was a mistake. The actual code is:
TestClass tc = new TestClass();
But, try it for yourself. The error is easy to duplicate.
> Make sure that the page class and your class are in the same namespace
That doesn't appear to matter. The error can be duplicated in less than a
minute.
Roy
q() was a mistake I made when posting. The actual code uses TestClass();
Please duplicate the error - it takes less than a minute. It seems that MS
has created restrictions where code can be placed.
Thanks.
Roy
Even though new q() looks fishy, reported bug is not related to it. The
compiler doesn't recognize the TestClass.
--
Stoitcho Goutsev (100) [C# MVP]
"Roland" <ro******************@gmx.net> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... Sorry Roy - I didn't read that carefully enough For my opinion you have to write: TestClass tc = new TestClass();
Your code: TestClass tc = new q(); is not valid - how can the compiler know what this 'q()' is - even we can not :)
Hope this helps Roland
> The compiler has to be able to find it. Either put it in a separate assembly and use a reference, or put it in the APP_CODE folder.
Your statement implies that, now, I must put place all referenced code in
the APP_CODE folder or create an entirely new project and reference it. In
othere words, in VS2005, Microsoft has restricted where I can place my code.
Where I once had the ability to structure according to logical functionality,
now I can't.
> Make sure that the page class and your class are in the same namespace
They are in the same namespace - the global namespace. Still, specifying a
namespace doesn't work either.
Roy
Please note:
In Visual Studio 2003, the exact code compiles, cleanly, without error.
Roy
Roy,
This is true. Since there is no more project files for websites you need to
follow predefined folder structure. you can add additional code floders
using the <codeSubDirectories> in the web.config, but all code folders have
to be subfolders of App_Code.
--
Stoitcho Goutsev (100) [C# MVP]
"Roy" <Ro*@discussions.microsoft.com> wrote in message
news:DB**********************************@microsof t.com... Otherwise, have you tried adding the test class to your APP_CODE Folder?
Yes, I have...and it works great. The problem is that I don't want to place the code in the APP_CODE folder. I want to place code where it logically makes sense.
Has Microsoft restricted where I can place code?
Thanks!
I appreciate your reply and I believe you, although, I don't like it.
However, since this is the case, Team Studio should automatically place code
in the APP_CODE folder and not prompt you for permission. It's misleading. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: savesdeday |
last post by:
In my beginnning computer science class we were asked to translate a
simple interest problem. We are expected to write an algorithm that
gets values for the starting account balance B, annual...
|
by: ES Kim |
last post by:
#include <map>
#include <iterator>
#include <iostream>
#include <algorithm>
using namespace std;
typedef map<int, int> Map;
ostream& operator<<(ostream& os, const Map::value_type& v);
|
by: Christopher Benson-Manica |
last post by:
(Followups set to comp.std.c. Apologies if the crosspost is unwelcome.)
strchr() is to strrchr() as strstr() is to strrstr(), but strrstr()
isn't part of the standard. Why not?
--...
|
by: |
last post by:
I am trying to compile a simple c# class in Web Matrix called howdy.cs:
// Program start class
public class HowdyPartner
{
// Main begins program execution
public static void Main()
{
//...
|
by: Rudy |
last post by:
I am writing a program in VB.NET and as I was debugging a problem I noticed my For loop doesn't want to loop!
I originally had a upper bound which was an expression and it wasn't working. WHen I...
|
by: Martin Horn |
last post by:
Hi,
I have encountered a problem with compiling my project. Basically what
happened was that I noticed my PC date was set a day into the future, so I
reset it to the correct date. Now when I...
|
by: Sourcerer |
last post by:
I wrote this very simple code in .NET VC++. I compiled it on my system, and
tried to run it on my friend's computer (he doesn't have the compiler). We both
have Windows XP Professional. I have .NET...
|
by: hn.ft.pris |
last post by:
Hi:
I have the following simple program:
#include<iostream>
using namespace std;
int main(int argc, char* argv){
const double L = 1.234;
const int T = static_cast<const int>(L);
int arr;
|
by: mwelsh1118 |
last post by:
Why doesn't C# allow incremental compilation like Java?
Specifically, in Java I can compile single .java files in isolation.
The resulting individual .class files can be grouped into .jar files....
|
by: =?Utf-8?B?U2NvdHQgUy4=?= |
last post by:
I need to have custom event subscribe and unsubscribe methods in some code in
my application when I ran into this problem.
I created this simple class to demostrate the compile problem.
The use of...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |