E
E
el-bekasto2020-06-03 22:02:56
C++ / C#
el-bekasto, 2020-06-03 22:02:56

Csc.exe not seeing other classes?

I need to compile c# code through the command line, namely through csc.exe. I created a folder where I placed the main code and one more code with a class. When I compile the code via cmd, an error is displayed, supposedly there are no classes. What should be done? Change namespace?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GavriKos, 2020-06-03
@el-bekasto

Well, you need to feed ALL files to the compiler,
Read:
https://docs.microsoft.com/en-us/dotnet/csharp/lan...

C
Collin, 2020-06-04
@Collin

You do like this:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe C:\Users\user\Documents\Projects\proj\main.cs

And you need it like this:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe C:\Users\user\Documents\Projects\proj\*.cs

*.cs, where *- all files with the extension .cs
In general, it is best to first go to the directory where your compiler is located, so that it would be more convenient to use it, this is a standard command cd <your_path>, and it would all look something like this:
cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
csc.exe C:\Users\user\Documents\Projects\proj\*.cs

It's just more convenient to use.
And familiarize yourself with cmd/powerhell/terminal at least basicly. Learn how to use commands such as:
cd ./path
ls ./path 
cp ./path ./path
mv ./path ./path
mkdir <dir_name> 
> filename.anyext

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question