We just hit an interesting error on our build server when compiling some recent changes from the command line:
c:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe
error CS0246: The type or namespace name 'var' could not be found (are you missing a using directive or an assembly reference?)
Code in question:
var response = _producerErrors.CreateTextMessage();
_producerErrors
is type of IMessageProducer from Apache.NMS
response
is type of ITextMessage
Note that it successfully compiles from Visual Studio, and I can reproduce the error locally from the command line, which I think rules out a configuration issue with the build server.
The fix is trivial of course but it's got me stumped as to why compilation is only failing from MSBuild command line? The project in question has other var
keywords in use which are compiling just fine, so I suspect it might be something to do with the Apache assembly, but what?