Skip to content

How to compile class library with roslyn? #46307

Answered by jmarolf
koinas asked this question in General
Discussion options

You must be logged in to vote

If you want to know how to compile a given scenario all you need to do is get the commandline.

if you have the sdk installed, you can run these commands to create a new project and produce a log.

dotnet new classlib
dotnet build /bl

that will produce a msbuild.binlog file that you can upload to https://live.msbuildlog.com/

wait a bit for the viewer to load your log

search for "csc" to filter the results

clicking on that will give you the commanline that the compiler used to build the library.

this is the set of arguments that are passed to csc on my machine:

C:\Program Files\dotnet\dotnet.exe exec "C:\Program Files\dotnet\sdk\5.0.100-rc.1.20420.14\Roslyn\bincore\csc.dll" 
/noconfig
/uns…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jmarolf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants