简体   繁体   中英

How can I avoid a full recompile when compiling a C# project with Roslyn?

I am using Roslyn for some code generation in one of my C# projects. Currently Roslyn will take the entire project, compile it from scratch, then spit out the code I want. This takes a full recompile to do, which is a little slow. When Visual Studio compiles a project it doesn't do it from scratch every time, it does something smart and only re-compiles the parts that have changed. Is there some way to do this with Roslyn?

Visual Studio (in the upcoming version) uses Roslyn to compile the code (to IL). For a single project that is not incremental and never was.

I may be wrong as I'm not sure about Roslyn, but you may be able to seperate the Roslyn code into another solution and have a seperate solution for your own code.

After that you can simply build the solution that changes all the time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM