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

Home Posts Topics Members FAQ

compilation error (class library error)

Hello,
I am trying to compile a project and get the following error:
A project with an Output Type of Class Library cannot be started
directly

Can somebody explain me why?
Thank you very much!

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
7 1217
juli jul wrote:
I am trying to compile a project and get the following error:
A project with an Output Type of Class Library cannot be started
directly

Can somebody explain me why?


Well, a class library is just not a executable type of project. If you
want to execute the result of your compilation, you need to create a
project with the word "Application" in its name (the name that's shown
in the New Project dialog).

Now that you have created the class library, it's not really easy to
change it to an executable type, so it would probably be best if you
just created a new project, probably of type "Windows Application", and
take over the code you have already written. If you absolutely need to
convert the project you already have, please don't hesitate to ask again.

Oliver Sturm
--
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog
Nov 17 '05 #2
It sounds to me like you are not trying to compile the project but you are
trying to execute it or debug it.

In this case you have a library which, generally speaking, does not have an
entry point. You are probably pressing F5 or Ctrl+F5 in Visual Studio which
are actually the commands for debug and run without debugging respectively.
These commands do actually compile the project but they are not the way you
shoudl do it.

Hit Ctrl+Shift+B to build (i.e. compile+link+whatever else) your project or
select build from the build menu.

If on the other hand you are actually trying to execute your library then
chance are you shoudl have a console app or a windows forms app so you should
just right click on the project, go to properties, and then change the
"Output Type" from Class library to something else.

Hope this helps

--
Brian Delahunty
Ireland

http://briandela.com/blog
"juli jul" wrote:
Hello,
I am trying to compile a project and get the following error:
A project with an Output Type of Class Library cannot be started
directly

Can somebody explain me why?
Thank you very much!

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #3
I can't change the project name.What can I do in order to solve this?
Thanks


*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #4
juli jul wrote:
I can't change the project name.What can I do in order to solve this?

[...snip...]

Oliver's post was a little misleading. He didn't want you to change the
project name, but the project type. When creating a new project, VS asks you
to specify what kind of project you want to open.
If you select "class library", you will not be able to *execute* the
project. The build will perfom ok. If you need an executable, you'd have to
select any item with "application" in it's name _upon project creation_.

Refer to Biran's post on what to do to make your project compile correctly.
Nov 17 '05 #5
Michael Voss wrote:
I can't change the project name.What can I do in order to solve this?
[...snip...]

Oliver's post was a little misleading. He didn't want you to change the
project name, but the project type. When creating a new project, VS asks you
to specify what kind of project you want to open.
If you select "class library", you will not be able to *execute* the
project. The build will perfom ok. If you need an executable, you'd have to
select any item with "application" in it's name _upon project creation_.


Sure, that's what I meant.
Refer to Biran's post on what to do to make your project compile correctly.


And what Brian suggests was something I didn't want to suggest, because
a class library project will not contain a Main method and it will be
difficult to explain how to create one manually. That's why I suggested
creating a new project to start with and taking over the important parts
that may have been created already in the class library project.

Oliver Sturm
--
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619 http://www.sturmnet.org/blog
Nov 17 '05 #6
Thank you very much,that was my problem (the build)

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #7
You're welcome. Glad I could help.
--
Brian Delahunty
Ireland

http://briandela.com/blog
"juli jul" wrote:
Thank you very much,that was my problem (the build)

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #8

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

Similar topics

6
by: Joachim | last post by:
I made some project changes (which seems it doesn't help if I undo) which have created compilation error: " Server Error in '/PCSWebApp1' Application....
5
by: Raterus | last post by:
I'm just throwing this error out for my sanity, I've seen posts about this, but never solutions. I'm using VS.NET 2003, Framework 1.1, and I'm getting a random error about every 1 out of 10 times...
3
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition...
2
by: VB Programmer | last post by:
I created a ASP.NET app locally and it works great. Uploaded it to my server and I get this error when trying to view a page. Any ideas? Server Error in '/earlyalert3' Application....
2
by: Kevin R. | last post by:
I have been ignoring this problem for a few weeks now, but it's becoming a bit annoying not to mention unproductive. Here it goes: I compile my project with no errors. Then after I debug/run it,...
0
by: z f | last post by:
i compile and test my vb.net asp.net web app. once in an hour or so i get a compilation error that only when i do IISRESET goes away. nothing related to my code. i compile and test on win XP...
3
by: Robert | last post by:
I have a number of web projects converted from 1.1 to 2.0 in VS2005. I am methodically seeing the error below: The element 'compilation' has invalid child element 'compilers'. List of...
6
by: JimO | last post by:
I have a namespace called utility that I compiled using the /t:library switch. It compiles fine. When I try to import it into a database interface namespace, I get an error on compilation that...
35
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....
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
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...
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
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...
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.