csc is the C# compiler. You can build programs that rely on the framework in it. But the compiler isn't enough when you start relying on third party libraries. For those you first have to restore the NuGet packages and then build. While you can do all this by hand there is no reason to. In fact VS doesn't run csc when you build, it runs MSBuild which is the build system. Internally that tool will eventually run the compiler for your files.
To build your app like VS does (from a command prompt that has the dev tools installed) just run msbuild <solution>.sln. For example if your solution is called WindowsFormsApp1 then msbuild windowsformsapps.slnand it'll build everything like VS does. If you are in the directory where the solution (or project) file are then you can simply runmsbuild. If you want to use the same configuration/platform that VS is ultimately passing to the build system then do something like this msbuild <solution>.sln /p:Configuration=Debug /p:Platform=AnyCPU`.
Note that if you want to see the actual build command VS is running then go to Tools\Options -> Projects and Solutions -> Build and Run and change the MSBuild output verbosity to something more than minimal. You can then see the command being run.
ence because I can compile it on VS19. It only gives error on cmd.