I suggest you ...

Bring back incremental C# compilation

When coding Java in Eclipse, the compiler incrementally compiles the project in the background every time a file is saved. This way, when the user clicks run, the launch is instantaneous, rather than the long build process that comes with C#. This makes it easier to develop and test small changes, which in turn makes it easier to find and fix bugs.

The C# compiler originally had this functionality, but it was removed when .NET 2.0 arrived as it could sometimes cause problems. However, given that it been proved possible in an equivalent language by the Eclipse team, coupled with the obvious advantages a robust implementation of such a feature would bring, makes it an ideal candidate to be reintroduced.

In recent years the C# team has not shied away from difficult and advanced features, so I am confident they could achieve this, and it should provide a big improvement to developer productivity and satisfaction, and make C# more competitive with scripting languages for rapid, iterative development.

557 votes
Sign in
Password icon
Signed in as (Sign out)
You have left! (?) (thinking…)
Jon Rimmer shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Password icon
Signed in as (Sign out)
  • Buck Mayzes commented  ·   ·  Flag as inappropriate

    This is number 14 on the list of issues, it's a feature that existed in the past, and Typescript does this beautifully. @ahejlsberg - can you put eyes on this?

  • Michal Ciechan commented  ·   ·  Flag as inappropriate

    Personally would prefer to see a version that is similar to webpack.

    Runs constantly, and keeps a cache what has been built and what hasn't in memory (down to the file level) and only rebuilds those files that have changed (and any dependencies if external facing contract changed, e.g. member signatures changes, member body changes as that is internal implementation)

    I currently work on a large WPF GUI application that takes 2 minutes to build. And I would say 60% of the time I am editing the logic inside existing methods, and sometimes it is just a typo in some text, and still have to wait the whole 2 min for a build. Add another 10-30 sec to actually re-build the test projects and run the test, it just slows everything down and the REPL is soooooooo slow.

    Ideally we would split out the project into multiple projects so that only a smaller subset needs to be rebuilt, but there is never time to do that as it would involve massive high risk merge conflicts as everyone keeps working on the same project and days of testing which the business never gives!

    It would also be nice to have this constantly running MsBuild server to cache everything including previous files in memory!

  • Ognyan Dimitrov commented  ·   ·  Flag as inappropriate

    I think the underlying request is : Make something so the compilation happens at least two times faster! Probably something link Zinc compiler running on Nailgun or Pants or other setup ( Java world ).

  • David Schwartz commented  ·   ·  Flag as inappropriate

    Hey Jon, it is indeed annoying how long it takes to go from making the change to running the app and seeing the results. In fact, it seems like this was once much faster. But when I thought about it, it occurred to me that the problem was the complex dependency tree in large applications. One (of our many) website projects has a total of 48 projects in the solution, and most of those projects are close to the top of the dependency hierarchy, while most of our work is close to the bottom. For example, the DAL projects only depend on five projects, but most day-to-day work involves updating the layers to make use of a new column or table. That means that I spend most of my work at a level where every change will affect 40+ projects within the solution. I think that most (not all) build-time issues are due to problems like this. Incremental compilation means that every DAL change will cause tens of thousands of lines to be recompiled. Most saves do not result in a complete feature, meaning a whole lot of wasted CPU/IO time that would be better spent analyzing my current work and helping me identify possible mistakes (static analysis) and explore my codebase (intellisense). I think that's why incremental compilation, in the old form, doesn't exist.

  • Jeff Winn commented  ·   ·  Flag as inappropriate

    RIA services was doing something similar for intellisense purposes by automatically compiling the project on you however was removed as of version 1.2. I'd definitely avoid putting this in, for larger solutions this was a huge headache. It's fine if you're in a smaller solution without a lot of projects, but if you're in a large solution with a lot of projects depending on the project you just changed, it creates a huge hassle. Just my opinion.

  • Fabian Schmied commented  ·   ·  Flag as inappropriate

    @sampai: ReSharper is a great tool and I am using it, but it does not make the launch of a project instantaneous at all - it only parses the code, it doesn't produce any binaries.

  • sampai commented  ·   ·  Flag as inappropriate

    Use ReSharper. It does all you need and eventually will boost your productivity many times.

  • Fabian Schmied commented  ·   ·  Flag as inappropriate

    Maybe the parser that currently generates the squiggly red lines for errors (this is often called "background compilation") could be extended to perform the incremental compilation.

Feedback and Knowledge Base