Print and/or modify the c# version that the razor compiler service uses to compile cshtml

Feb 25, 2014 at 7:33 AM
Hi,

I'd like to be able to find out which C# version razor uses to compile my cshtml templates. The reason why I want this, is this breaking change.

We had a lambda in a foreach statement that worked fine on our local dev machines but produced a bug on our test environment (which doesn't have C# 5 installed). This bug was VERY hard to debug (we even copied all the test environment DLLs and databases and were still not able to reproduce the bug). After having tested all the underlying code we started to debug the cshtml files and found the bug.

So to prevent this dev/test difference in the future I would like to know if there's a way to specify the C# version that razor should be using to compile cshtml files. It would also be nice if I could check the C# version that razor uses (by printing it).