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.
csc
does not work with .csproj
files. You have a few options:
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>
)
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)
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