Question

This is a follow-up to: Projection using async delegate/lambda

Apparently, the Async CTP has a bug that I've hit into, and I need to use the VS11 compiler. At the command-line, running msbuild even against a project written in VS2010 still compiles with the VS11 compiler because VS11/.NET 4.5 installs in-place in the .NET 4.0 directory.

However, inside Visual Studio 2010, an in-process compiler is used which seems to not have been upgraded to the new VS11 compiler.

Can I (through some hackery / DLL manipulation) change the compiler that Visual Studio 2010 uses? This would just be a hack/workaround until VS11 supports Windows Azure, so that I can upgrade to the beta/release candidate/RTM.

Was it helpful?

Solution

You may run into some success using the little-known property UseHostCompilerIfAvailable. That should cause build within the IDE to use the compiler in the framework directory.

However IDE features such as intellisense will always use the in-proc compiler. If the bug you're hitting is only on the final transformations of async methods though, you may find that the in-proc compiler is good enough for intellisense, and that UseHostCompilerIfAvailable is good enough to allow you to build from VS.

You set it by manually editing your csproj file to include

<UseHostCompilerIfAvailable>false</UseHostCompilerIfAvailable>

in the top property group.

Also - VS11 supports "roundtripping"! In most scenarios you can open your VS10 project using VS11 without forcing an upgrade. Thus if you have a team need to keep your project in the V10 format for the time being, you can at least independently use VS11. However, this is harder if there are addins that you need that have yet to be released for VS11.

Hope this helps! :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top