CS0234 Error while compile on cmd

aykol 1 Reputation point
2021-10-25T12:50:28.3+00:00

Hi, I'm newbie of c# and working with DevExpress. I can compile the project via VS19 but when I want to compile it on cmd, it gives me cs 0234 error which says "The type or namespace name 'DevExpress' could not be found (are you missing a using directive or an assembly reference )". I have no issue about refer143457-screenshot-2.pngence because I can compile it on VS19. It only gives error on cmd.

What I need to do solve this?

143458-screenshot-1.png

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 61,106 Reputation points
    2021-10-25T14:35:37.893+00:00

    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.

    0 comments No comments

  2. MotoX80 37,156 Reputation points
    2021-10-25T15:11:28.853+00:00

    If you already have VS19 installed and can successfully compile the code, why do you want to use the csc command line compiler?

    I think that you need to add a reference to any external dll's.

    https://stackoverflow.com/questions/44489258/adding-assembly-references-for-compiling-with-developement-console

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.