473,545 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmaticall y Compiling CSharp Code Using C# Compiler ???

Hi,

The following article describes how to compile CSharp code
programmaticall y http://support.microsoft.com/default.aspx?
scid=http://support.microso ft.com:80/support/kb/articles/Q3
04/6/55.asp&NoWebCon tent=1

When I'm trying to compile CSsharp code (See code below)
which includes the "using System.Data" namespace I'm
receiving the following error message

Line number 3, Error Number: CS0234, 'The type or
namespace name 'Data' does not exist in the class or
namespace 'System' (are you missing an assembly
reference?);

Can anyone tell what is wrong?
using System;
using System.Data;

namespace HelloWorld
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class HelloWorldClass
{
static void Main(string[] args)
{
Console.WriteLi ne("Hello World!");
Console.ReadLin e();
}
}
}

Thanks,
Alexander

Nov 15 '05 #1
3 2974
Alex,

When you are compiling, are you referencing System.Data.dll ? You need
to set the reference so the compiler knows about the types in that assembly.
The "using" directive is just shorthand so you dont always have to use the
full type name, it doesn't pull in the reference.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Alex" <al******@hotma il.com> wrote in message
news:0c******** *************** *****@phx.gbl.. .
Hi,

The following article describes how to compile CSharp code
programmaticall y http://support.microsoft.com/default.aspx?
scid=http://support.microso ft.com:80/support/kb/articles/Q3
04/6/55.asp&NoWebCon tent=1

When I'm trying to compile CSsharp code (See code below)
which includes the "using System.Data" namespace I'm
receiving the following error message

Line number 3, Error Number: CS0234, 'The type or
namespace name 'Data' does not exist in the class or
namespace 'System' (are you missing an assembly
reference?);

Can anyone tell what is wrong?
using System;
using System.Data;

namespace HelloWorld
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class HelloWorldClass
{
static void Main(string[] args)
{
Console.WriteLi ne("Hello World!");
Console.ReadLin e();
}
}
}

Thanks,
Alexander

Nov 15 '05 #2
Is it possible to set up the reference programmaticall y?
What lines of code should I add to my SCharp code sample?

Thanks,
Alex
-----Original Message-----
Alex,

When you are compiling, are you referencing System.Data.dll ? You needto set the reference so the compiler knows about the types in that assembly.The "using" directive is just shorthand so you dont always have to use thefull type name, it doesn't pull in the reference.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Alex" <al******@hotma il.com> wrote in message
news:0c******* *************** ******@phx.gbl. ..
Hi,

The following article describes how to compile CSharp code programmaticall y http://support.microsoft.com/default.aspx? scid=http://support.microso ft.com:80/support/kb/articles/Q3 04/6/55.asp&NoWebCon tent=1

When I'm trying to compile CSsharp code (See code below)
which includes the "using System.Data" namespace I'm
receiving the following error message

Line number 3, Error Number: CS0234, 'The type or
namespace name 'Data' does not exist in the class or
namespace 'System' (are you missing an assembly
reference?);

Can anyone tell what is wrong?
using System;
using System.Data;

namespace HelloWorld
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class HelloWorldClass
{
static void Main(string[] args)
{
Console.WriteLi ne("Hello World!");
Console.ReadLin e();
}
}
}

Thanks,
Alexander

.

Nov 15 '05 #3
When calling the static Compile method, the imports parameter should be
populated with an array of strings representing the assemblies to import for
the build.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<an*******@disc ussions.microso ft.com> wrote in message
news:08******** *************** *****@phx.gbl.. .
Is it possible to set up the reference programmaticall y?
What lines of code should I add to my SCharp code sample?

Thanks,
Alex
-----Original Message-----
Alex,

When you are compiling, are you referencing

System.Data.dll ? You need
to set the reference so the compiler knows about the

types in that assembly.
The "using" directive is just shorthand so you dont

always have to use the
full type name, it doesn't pull in the reference.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Alex" <al******@hotma il.com> wrote in message
news:0c******* *************** ******@phx.gbl. ..
Hi,

The following article describes how to compile CSharp code programmaticall y http://support.microsoft.com/default.aspx? scid=http://support.microso ft.com:80/support/kb/articles/Q3 04/6/55.asp&NoWebCon tent=1

When I'm trying to compile CSsharp code (See code below)
which includes the "using System.Data" namespace I'm
receiving the following error message

Line number 3, Error Number: CS0234, 'The type or
namespace name 'Data' does not exist in the class or
namespace 'System' (are you missing an assembly
reference?);

Can anyone tell what is wrong?
using System;
using System.Data;

namespace HelloWorld
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class HelloWorldClass
{
static void Main(string[] args)
{
Console.WriteLi ne("Hello World!");
Console.ReadLin e();
}
}
}

Thanks,
Alexander

.

Nov 15 '05 #4

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

Similar topics

11
3169
by: Arturo DiDonna | last post by:
Hello everyone. I am trying to compile someone else code and I am stuck with compilation problems using the g++ 3.3 compiler. Basically, when compiling the following code, I get this error message: parsefcns.cc: In function `void get_token(std::ifstream*, char**)': parsefcns.cc:57: error: cannot convert `std::basic_string<char,...
3
1453
by: raghavendra | last post by:
while compiling windows service Project configuration skipped because it is not selected in this solution configuration Regards, Raghavendra
4
11331
by: Aaron Queenan | last post by:
When I build a C++ library to .NET using the managed C++ compiler, I get the following error message: Linking... LINK : error LNK2020: unresolved token (0A000005) _CrtDbgReport LINK : error LNK2020: unresolved token (0A000007) memset LINK : error LNK2020: unresolved token (0A000008) free LINK : error LNK2020: unresolved token (0A00000A)...
7
9974
by: Clint Herron | last post by:
Howdy! I posted this question on CSharpCorner.com, but then realized I should probably post it on a more active newsgroup. This will be my only cross-post. I'm creating a game engine, and using CodeDOM for my scripting needs (I realize I could use yacc or something else, but I wanted to try using CodeDOM -- this is more of an exercise for...
2
1936
by: Justin Naidl | last post by:
A group of friends and I are doing a RPG (role-playing game) maker for a school project. It occured to us, however, that if you want the user to be able to have almost complete control over the contents of his/her game, that you would end up with a tiny executable and a huge datafile. We wanted to keep clear of this as disk accesses take a...
0
1748
by: Ramesh2006 | last post by:
Hi, The following error occurred when i programmatically compile another project from my present project. The Error: error CS0234:The type or namespace name 'Windows' does not exist in the namespace 'System' <are you missing an assembly reference> The Source Code:
3
9750
by: rockdale | last post by:
Hi, all Could somebody tells me where can I set "Allow unsafe code" in visual studio 2005. I could not find any Project Properties|Configuration Properties in my website solution. Mine appl is a VS 2005 Web Site Projects, should I migrate to VS 2005 Web Application Projects? Thanks a lot
13
3792
by: Albert | last post by:
Hi I'm using the lcc compiler for win32. I tried compiling a program but there's an error stating: "cpp: Can't open input file clrscr()" I don't get it - I've included <tcconio.h>. (strange why they couldn't have just left it as <conio.h>?): #include <tcconio.h> // code
13
2163
by: Analizer1 | last post by:
Hello all I have a idea...and dont know if it is possible...... we have a pretty huge system at work and we send EDI Special formatted Data to Several Other Companies, via sFtp,dial up, vpn depending on these customers requirements one of the areas we are using a implimentation in vb6 (yuck) but works...slow as well u know,
0
7484
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7928
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7775
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5997
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5344
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4963
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3451
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1902
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1030
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.