Question

csc /target:library /out:MyMaths.dll ClassLibraryFunction.csproj

I am using this code to generate a DLL in VS.Cmd compiler for a whole solution. However, I am getting a compile error, and the DLL is not being generated.

Was it helpful?

Solution

csc does not work with .csproj files. You have a few options:

  1. use msbuild; for example

    msbuild ClassLibraryFunction.csproj
    

    noting that you may need to change the output-type of the project (in the IDE this is Project Properties, Application, Output type; in the csproj file this is <OutputType>Library</OutputType>)

  2. use csc with the /recurse switch; for example:

    csc /target:library /out:MyMaths.dll /recurse:*.cs
    

    (which will compile all the .cs files in the current folder or in sub-folders)

  3. do nothing whatsoever, and just use the exe that you already have; a .NET exe can be referenced just like any other assembly, and any public types can be consumed

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top