473,395 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Visual Studio 2005

Hi,

Background: I'm a Java programmer new to c# and Visual Studio.

Problem: When I compile in Visual Studio 2005, the compiler complains,
that it can not find several different namespaces. Examples:

Error 1 The type or namespace name 'Soap' does not exist in the
namespace 'System.Runtime.Serialization.Formatters' (are you missing an
assembly reference?)

Error 2 The type or namespace name 'Drawing' does not exist in the
namespace 'System' (are you missing an assembly reference?)

When I compile from the command prompt there are no problems.
What can be wrong? It seems like Visual Studio is somehow not including
the full API.

Kind regards,
Mads Peter Nymand

Mar 7 '06 #1
5 4021
The VS doens't reference all dlls. How many dlls it references depends on
the type of project you've created (wizard).

If you open the "References" node you'll see all ther referenced assemblies.
Keep in mind that one namespace might be spread over more than one assembly
(even though it is not the common case), so you may have some classes form
the namespace available and some not.

If you in doubt what dll to reference open the MSDN docs (if it goes for a
API type) and in the "About ... type" section you can find out the dll it
comes from.

Why it can compile in command prompt? I guess is because the line compiler
is set up to reference bigger set of dlls.
--
HTH
Stoitcho Goutsev (100)

"Mads Peter Nymand" <ma*******@oncable.dk> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hi,

Background: I'm a Java programmer new to c# and Visual Studio.

Problem: When I compile in Visual Studio 2005, the compiler complains,
that it can not find several different namespaces. Examples:

Error 1 The type or namespace name 'Soap' does not exist in the
namespace 'System.Runtime.Serialization.Formatters' (are you missing an
assembly reference?)

Error 2 The type or namespace name 'Drawing' does not exist in the
namespace 'System' (are you missing an assembly reference?)

When I compile from the command prompt there are no problems.
What can be wrong? It seems like Visual Studio is somehow not including
the full API.

Kind regards,
Mads Peter Nymand

Mar 7 '06 #2
Thanks a lot for your answer.

Maybe the command prompt compiler is set to include the full C# 2.0
Class Library the same way, that the Java command line compiler is set
to include the full java API class library.

It raises a new question though:

In the command prompt and in the Java IDEs I have used, the whole API
class library of the SDK is included by default. Why isn't it so in VS.
Why do you have such a limited set of references in a C# project in VS?
In the top of a file, you are declaring which namespaces to use. That
makes sense, because you have to define, which namespaces the classes
you are using, are belonging to. In my opinion, it does not make sense,
that you have to define new references (add refernces) at project
level, when you are using namespaces, that is part of the standard C#
library. That's just extra work for no reason. Can anybody give me a
reason why it is so - better stucture? faster execution? - something

Mads Peter

Mar 7 '06 #3
Mads Peter Nymand <ma*******@oncable.dk> wrote:
Thanks a lot for your answer.

Maybe the command prompt compiler is set to include the full C# 2.0
Class Library the same way, that the Java command line compiler is set
to include the full java API class library.
No - it's set to include a certain set of assemblies. (The difference
is that with Java, all the standard libraries are in one big jar file -
rt.jar.)

If you look in your .NET framework directory, find a file called
csc.rsp. That lists the command-line options which are specified by
default.
It raises a new question though:

In the command prompt and in the Java IDEs I have used, the whole API
class library of the SDK is included by default. Why isn't it so in VS.
Why do you have such a limited set of references in a C# project in VS?
Because Java doesn't really have "references" to start with. You can
put lots of things on a classpath, but it's not really the same thing.
Instead, it's got a huge standard library in one big file. That's not
really great from an organisational perspective.
In the top of a file, you are declaring which namespaces to use. That
makes sense, because you have to define, which namespaces the classes
you are using, are belonging to. In my opinion, it does not make sense,
that you have to define new references (add refernces) at project
level, when you are using namespaces, that is part of the standard C#
library. That's just extra work for no reason. Can anybody give me a
reason why it is so - better stucture? faster execution? - something


Firstly, it's not the standard C# library - it's the standard .NET
framework. C# is just *one* language targetting the .NET framework.

Secondly, namespaces and assemblies are very different things. An
assembly often happens to have types within a namespaces of a similar
name to the assemblies, but they're different to namespaces.

"using" directives just provide shortcuts so you don't need to type the
full name of every type you're using. Assembly references govern which
types are available in the first place.

The .NET framework is better organised than Java in terms of the
standard library being broken up into separate units of functionality.
If you don't need anything to do with System.Messaging, why make either
the compiler or the runtime load that assembly?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 7 '06 #4
Thanks a lot for your answer Jon, that cleared things up pretty well.
The .NET framework is better organised than Java in terms of the
standard library being broken up into separate units of functionality.
If you don't need anything to do with System.Messaging, why make either
the compiler or the runtime load that assembly?


I see your point. Does the Java compiler and runtime have to load the
hole standard library (rt.jar) everytime you compile and run a java
program? If this is the case, it doesn't seem optimal. I always thought
that Java only loaded the packages specified in the import statements.

Mads Peter

Mar 8 '06 #5
Mads Peter Nymand <ma*******@oncable.dk> wrote:
Thanks a lot for your answer Jon, that cleared things up pretty well.
The .NET framework is better organised than Java in terms of the
standard library being broken up into separate units of functionality.
If you don't need anything to do with System.Messaging, why make either
the compiler or the runtime load that assembly?


I see your point. Does the Java compiler and runtime have to load the
hole standard library (rt.jar) everytime you compile and run a java
program? If this is the case, it doesn't seem optimal. I always thought
that Java only loaded the packages specified in the import statements.


No - the import statement is only the equivalent of the "using"
directive in C#. It's just a namespace issue.

Now, I don't know the extent to which the Java runtime loads the whole
standard library. I'm sure it loads the index telling it which classes
are available and where within the jar file. My guess is that it then
memory maps the file and accesses the classes it needs as it needs
them.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 8 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Shapper | last post by:
Hello, I am starting 2 new projects to deliver in January 2006. I want to create them in Asp.Net 2.0 using Visual Studio 2005. All my clients web sites are Visual Studio 2003 projects in...
0
by: fiona | last post by:
Innovasys Ltd., a leader in help authoring and documentation tools, today announced the inclusion of a tailored version of the Innovasys HelpStudio help authoring product, HelpStudio Lite, in the...
2
by: Progman | last post by:
I have Visual Studio 2005 Standard edition. Is ti the same thing as the Express edition or Standard is more?
12
by: Nathan Sokalski | last post by:
I recently upgraded to from Visual Studio .NET 2003 to Visual Studio .NET 2005. In Visual Studio .NET 2003 when I would select 'Build' it would add a *.dll with the name of the Project to a /bin/...
18
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft...
8
by: WT | last post by:
Is it normal that Visual Studio sets the PreInit handler for a Page from the OnInit code ? No chance to fire it as OnPreInit is run befor OnInit. ??? CS
3
by: Edwin Smith | last post by:
I have a 2 form project in VS2005 that now hangs whenever I try to do anything with the second form. This seems to have started when I added some SQL tables from a Pervasive v.9 database using the...
1
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
1
by: Dr T | last post by:
Hi! I downloaded MS Visual Web Developer 2005 Express Edition, MS .NET Framework SDK v2.0, and MS SQL Server 2005. Subsequently, I bought MS Visual Studio 2005 Professional Edition. 1) Are...
3
by: Rachel Garrett | last post by:
This is driving me mad. I have Visual Studio.NET PRO 2005 installed on my machine at work. I want to write a web service. I find lots of tutorials on how to do this with Visual Studio.NET; some are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.