C# Questions

G

Gene Wirchenko

Dear C-Sharpies:

I have some general questions that I have not been able to find
the answers for:

1) I am using Visual C# 2010 Express. The text that I am using
refers to command-line invocation of the compiler. What is the name
of the compiler's executable? They use csc.exe, but this does not
appear to be the name.

2) Is it possible to have my code default to checked?
a) If so, how do I set this?
b) If not, what is the easiest way to do this? Would putting a
checked block encompassing each source file do it?

3) The IDE is confusing at times. In particular, when I add an
existing file to a project, they do not show up anywhere, but then
they are in the project anyway. (This caused me a problem when I
added a file that had duplicate class names in it. I could not figure
out how to remove the file from the project or how to edit it within
the project to correct the duplicate names.)

4) Is there anything else that commonly feeds on C# newbies that you
would be so nice as to warn me about?

Sincerely,

Gene Wirchenko
 
A

Arne Vajhøj

I have some general questions that I have not been able to find
the answers for:

1) I am using Visual C# 2010 Express. The text that I am using
refers to command-line invocation of the compiler. What is the name
of the compiler's executable? They use csc.exe, but this does not
appear to be the name.

It is the name.

C:\Windows\Microsoft.NET\Framework\v4.0.30319>dir csc.exe
Volume in drive C is ARNEPC4
Volume Serial Number is F878-3B24

Directory of C:\Windows\Microsoft.NET\Framework\v4.0.30319

03/18/2010 01:16 PM 1,972,552 csc.exe

or similar based on versions.
2) Is it possible to have my code default to checked?
a) If so, how do I set this?
b) If not, what is the easiest way to do this? Would putting a
checked block encompassing each source file do it?

command line:

csc /checked+

VS:

project
properties
build
advanced
3) The IDE is confusing at times. In particular, when I add an
existing file to a project, they do not show up anywhere, but then
they are in the project anyway. (This caused me a problem when I
added a file that had duplicate class names in it. I could not figure
out how to remove the file from the project or how to edit it within
the project to correct the duplicate names.)

I don't think I have problems doing that.
4) Is there anything else that commonly feeds on C# newbies that you
would be so nice as to warn me about?

Assuming C# is like language X is a common cause for confusion.

Arne
 
R

RayLopez99

Dear C-Sharpies:

     I have some general questions that I have not been able to find
the answers for:

  1) I am using Visual C# 2010 Express.  The text that I am using
refers to command-line invocation of the compiler.  What is the name
of the compiler's executable?  They use csc.exe, but this does not
appear to be the name.

  2) Is it possible to have my code default to checked?
     a) If so, how do I set this?
     b) If not, what is the easiest way to do this?  Would putting a
checked block encompassing each source file do it?

  3) The IDE is confusing at times.  In particular, when I add an
existing file to a project, they do not show up anywhere, but then
they are in the project anyway.  (This caused me a problem when I
added a file that had duplicate class names in it.  I could not figure
out how to remove the file from the project or how to edit it within
the project to correct the duplicate names.)

  4) Is there anything else that commonly feeds on C# newbies that you
would be so nice as to warn me about?

Sincerely,

Gene Wirchenko

Good luck with your C# Express adventure. I personally have found the
"Express editions" are not quite 100% compatible with the other
editions in functionality--by definition of course. So I make sure I
get the "pro" version whenever possible. You can get an academic
discount from most places even without showing you are still in
university. Or you can take your chances and download it from a
torrent site, which 95% of the time is as good as the genuine product.

RL
 
A

Arne Vajhøj

Good luck with your C# Express adventure. I personally have found the
"Express editions" are not quite 100% compatible with the other
editions in functionality--by definition of course. So I make sure I
get the "pro" version whenever possible. You can get an academic
discount from most places even without showing you are still in
university. Or you can take your chances and download it from a
torrent site, which 95% of the time is as good as the genuine product.

But illegal 100% of the time!

Arne
 
M

Markus Schaber

Hallo,

RayLopez99 said:
Good luck with your C# Express adventure. I personally have found the
"Express editions" are not quite 100% compatible with the other
editions in functionality--by definition of course. So I make sure I
get the "pro" version whenever possible. You can get an academic
discount from most places even without showing you are still in
university. Or you can take your chances and download it from a
torrent site, which 95% of the time is as good as the genuine product.

Other free alternatives are SharpDevelop and MonoDevelop.



Gruss,
Markus
 
A

Arne Vajhøj

Other free alternatives are SharpDevelop and MonoDevelop.

Or maybe even Eclipse with Emonic.

The C# community in general is very VS focused. And that
is a bit of a shame, because even though VS is a good product
then knowing more products broadens ones horizon.

And some of the alternatives especially SharpDevelop (which I have used
extensively) is actually pretty good.

Arne
 
M

Markus Schaber

Hallo,

Arne Vajhøj said:
Or maybe even Eclipse with Emonic.

AFAICS, Emonic does not support the normal .sln/.csproj msbuild
infrastructure - this is a huge disadvantage if you want to share your
projects with other developers.
The C# community in general is very VS focused. And that
is a bit of a shame, because even though VS is a good product
then knowing more products broadens ones horizon.


And some of the alternatives especially SharpDevelop (which I have used
extensively) is actually pretty good.

SharpDevelop has some advantages (e. G. working parallel build
support, and working folder support) compared to the VS Express edition.

But neither of the free environments can compete with the high end
edition of visual studio, pimped with some plugins (Small ones like
GhostDoc, and more complex ones like ReSharper or CodeRush).

Which is a sad fact, compared to what Eclipse offers for Java for free
(and I think NetBeans is at the same level nowadays).



Gruss,
Markus
 
A

Arne Vajhøj

AFAICS, Emonic does not support the normal .sln/.csproj msbuild
infrastructure - this is a huge disadvantage if you want to share your
projects with other developers.

True.

But some incl. me prefer NAnt over MSBuild anyway.
SharpDevelop has some advantages (e. G. working parallel build
support, and working folder support) compared to the VS Express edition.

But neither of the free environments can compete with the high end
edition of visual studio, pimped with some plugins (Small ones like
GhostDoc, and more complex ones like ReSharper or CodeRush).

A lot of the extra stuff I don't need. Other people may of course
need it.

Arne
 
G

Gene Wirchenko

Dear C-Sharpies:
[snip]
3) The IDE is confusing at times. In particular, when I add an
existing file to a project, they do not show up anywhere, but then
they are in the project anyway.

Please be more specific. Describe _exactly_ what steps you are doing,
giving precise statements about what menu commands, keyboard shortcuts,
etc. you are using.

Adding anything to a project, including an existing file, will result in
the newly added item being visible in the project (typically you'd look
in the Solution Explorer to view the project contents).

If you are unable to see items added to the project, either your
installation of Visual Studio is broken or you are not doing what people
would normally consider to be "adding an existing file to a project".

Start -- Programs -- Microsoft Visual Studio 2010 Express -- Microsoft
Visual C# 2010 Express

Click on "New Project...", select "Console Application", enter
application name of "PointerPlayaround", and click OK.

At this point, I would like to delete Program.cs from the project
and from existence period. How? I think that it will not be saved
anywhere because I have not saved the project, but I do not know this.

Project -- Add Existing Item... --
C:\cbs2dev\CSharp\ch07code\PointerPlayaround.cs -- Add

Project -- Add Existing Item... --
C:\cbs2dev\CSharp\ch07code\PointerPlayaround2.cs -- Add

The filenames do not show up only some class definitions in the
class view. I do not see how classes and files fit together, that is,
which classes are in which files.

Build -- Build Solution

Error because both of the files that I added have a Main(). When
I use class view to get to the code, I can only see one.

With PointerPlayaround2.cs in focus, Project -- Exclude from
Project. Note that if I did not know what classes were in the file I
had just added, I would have to actually look at the file outisde of
Visual Studio to determine a unique class name that it has so that I
could select that and get the code to display so I could remove it. (I
know of no other way, short of recreating the project.) If the file
had no unique class names, I do not know how I would be able to remove
it, yet I would have compilation errors for the duplicate class
definitions.

Try adding it again:
Project -- Add Existing Item... --
C:\cbs2dev\CSharp\ch07code\PointerPlayaround2.cs -- Add
and get a message that it already exists: "A file with the name
'PointerPlayaround2.cs' already exists. Do you want to replace it?".
It thought it was the same file. Does it get copied into the project
directory structure? Where exactly is it so that I can delete it?

Remove it again.

Build -- Build Solution

Error because both .cs files (Program and PointerPlayaround) have
a Main() (though in different classes).

Exclude Program from the project.

Build -- Build Solution

F5

Execution at last. (Actually, I skipped the bit about setting so
the unsafe code will compile and run.)


If I save the project, does that save everything in it to the
same directory structure?

Sincerely,

Gene Wirchenko
 
G

Gene Wirchenko

On Fri, 26 Aug 2011 17:14:43 -0700, Peter Duniho

[snip]
Adding anything to a project, including an existing file, will result in
the newly added item being visible in the project (typically you'd look
in the Solution Explorer to view the project contents).

Oh, now I see the filenames. It would have been much clearer if
it were called Project Explorer. This probably clears up most of my
problems, for now anyway.
If you are unable to see items added to the project, either your
installation of Visual Studio is broken or you are not doing what people
would normally consider to be "adding an existing file to a project".

Nope. Just missing a bit of vocabulary ("Solution Explorer").

Thank you.

Sincerely,

Gene Wirchenko
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top