473,466 Members | 1,336 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Compile a C# source code file Without Building in IDE?

I'll guess this has been addressed many times, but my finding skills (Google
Groups, etc) seem to have failed me (not unheard of).
Using VS.NET 2003 Pro, I have a multi file project consisting of several
class definitions, each in its own file) from which I wish to instantiate
objects and test the classes in a simple console application with Main(),
contained in a separate file. As long as the file with Main() is in the
project, all is well and I can build/rebuild the project, thus recompiling
the code in all files as needed.
Now, I wish to remove with Main() and just recompile the other files
selectively as needed. When I do that, C# immediately complains that there
is no entry point. So, from C++ experience, I tried adding the Compile
button to the Build toolbar. No go, as the button appears, but is inactive.
I would like to be able to make these classes available to students without
revealing the source code, sort of like giving C++ developers the .h file,
but not the implementing companion .cpp.
So, the question is: is there a way to just compile C# from within the IDE,
or must I resort to using the command line for this activity? Once
accomplished, how do I expose the interface only? Further, is it possible
that what I want to do is inappropriate to the C# development model?

--
************************************************** ********************
** All opinions are mine alone.Do not attribute elsewhere!
************************************************** ********************
** Peter van der Goes, Professor, Computers & Information Technology
** Rose State College
*********************** Contact ************************************
** Office e-mail: pv**@rose.edu
** Home e-mail: p_**********@cox.net
** Web Page: http://www.rose.edu/Faculty/pvan/index.htm
************************************************** ********************
Nov 15 '05 #1
3 2230
Did you change the output type of the project to "Class library" ?

Arild

"Peter van der Goes" <p_**********@mars.cox.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I'll guess this has been addressed many times, but my finding skills (Google Groups, etc) seem to have failed me (not unheard of).
Using VS.NET 2003 Pro, I have a multi file project consisting of several
class definitions, each in its own file) from which I wish to instantiate
objects and test the classes in a simple console application with Main(),
contained in a separate file. As long as the file with Main() is in the
project, all is well and I can build/rebuild the project, thus recompiling
the code in all files as needed.
Now, I wish to remove with Main() and just recompile the other files
selectively as needed. When I do that, C# immediately complains that there
is no entry point. So, from C++ experience, I tried adding the Compile
button to the Build toolbar. No go, as the button appears, but is inactive. I would like to be able to make these classes available to students without revealing the source code, sort of like giving C++ developers the .h file,
but not the implementing companion .cpp.
So, the question is: is there a way to just compile C# from within the IDE, or must I resort to using the command line for this activity? Once
accomplished, how do I expose the interface only? Further, is it possible
that what I want to do is inappropriate to the C# development model?

--
************************************************** ********************
** All opinions are mine alone.Do not attribute elsewhere!
************************************************** ********************
** Peter van der Goes, Professor, Computers & Information Technology
** Rose State College
*********************** Contact ************************************
** Office e-mail: pv**@rose.edu
** Home e-mail: p_**********@cox.net
** Web Page: http://www.rose.edu/Faculty/pvan/index.htm
************************************************** ********************

Nov 15 '05 #2
Peter van der Goes <p_**********@mars.cox.net> wrote:
I'll guess this has been addressed many times, but my finding skills (Google
Groups, etc) seem to have failed me (not unheard of).
Using VS.NET 2003 Pro, I have a multi file project consisting of several
class definitions, each in its own file) from which I wish to instantiate
objects and test the classes in a simple console application with Main(),
contained in a separate file. As long as the file with Main() is in the
project, all is well and I can build/rebuild the project, thus recompiling
the code in all files as needed.
Now, I wish to remove with Main() and just recompile the other files
selectively as needed. When I do that, C# immediately complains that there
is no entry point. So, from C++ experience, I tried adding the Compile
button to the Build toolbar. No go, as the button appears, but is inactive.
I would like to be able to make these classes available to students without
revealing the source code, sort of like giving C++ developers the .h file,
but not the implementing companion .cpp.
So, the question is: is there a way to just compile C# from within the IDE,
or must I resort to using the command line for this activity? Once
accomplished, how do I expose the interface only? Further, is it possible
that what I want to do is inappropriate to the C# development model?


Compiling just *parts* of a project does sound somewhat odd. If you
just want to compile a project which doesn't have a Main, and give it
to them as a DLL, you just need to change the project type to a Class
Library.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3

"Jon Skeet" <sk***@pobox.com> wrote in message
news:MP************************@news.microsoft.com ...

Compiling just *parts* of a project does sound somewhat odd. If you
just want to compile a project which doesn't have a Main, and give it
to them as a DLL, you just need to change the project type to a Class
Library.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Thanks very much, Arild and Jon. I appreciate the helpful answer sans
sarcasm :-)
Obviously, I should have seen that.
Nov 15 '05 #4

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

Similar topics

2
by: LP | last post by:
Hi, I have a site which runs on .Net technology. The site is already deployed and running. I need to change 1 file for some small enhancement. Please tell me, how can I compile that 1 file and...
10
by: Jean-David Beyer | last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2 V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
1
by: Keith Clark | last post by:
When I load a csharp program into the MS DbgCLR.exe debugger and trace it everything is fine the first time. Assume now, I change somewhere a code statement in the source file (outside the...
2
by: MB | last post by:
Hello! At home I am using ASP.net to develop an asp application. Now I have copied this application to my IIS5.0 server at my workplace. Everything works fine, but then I would do a change in a...
0
by: Jérôme Le Bougeant | last post by:
Hello (and sorry for my English), I downloaded the VideoCapture module on the http://videocapture.sourceforge.net/ site. I tested it with a webcam and that functions. Now I want to...
5
by: DFB | last post by:
I am the author of the ZLibNetWrapper project on SourceForge (located at zlibnetwrapper.sf.net). This project is a simple mixed-mode .NET wrapper around the ZLib compression library. The ZLib...
0
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...
13
by: treble54 | last post by:
I need to build PHP from source with the pdo_ibm extension and I am having an issue with it. Firstly, I am using Visual Studio .NET 2003 and I am building PHP from source through the Visual Studio...
0
by: dot | last post by:
I spent a few headache filled days trying to use GMP on windows (XP pro) I finally got it to work and since I found little help on the Web I thought someone might find what i did useful. ...
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
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...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...

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.