MSBuild Compilation Error Weirdness
I'm getting an error compiling a VB .NET project using the MSBuild command line. Running from devenv works perfectly fine:
error BC30518: Overload resolution failed because no accessible 'Invoke' can be called with these arguments:
Line in question:
Windows.Application.Current.Dispatcher.Invoke(Sub() InteractionManager.Current.DisplayException((DirectCast(e.ExceptionObject, Exception))))
Why is MSBuild balking at this when DevEnv/Visual Studio is not? And why is this a problem at all? It looks fine to me.... The ONLY thing I see interesting about this line is that Invoke takes a Delegate class object (not a strongly typed delegate)...so in C#, I wouldn't be able to use a lambda expression where I am now in VB .NET开发者_运维知识库 (I'd need to do something like new Action(() => ...)
I believe that you are mixing .NET versions.
System.Windows.Threading.Dispatcher
has a single argument overload of the Invoke
method in .NET 4.5. In .NET 4.0 or older, all available overloads take two or more arguments which rules then out and gives you the error message you see.
I therefore assume that the devenv
you are executing is a VS2012 beta whereas the msbuild
is something more conventional.
You should be able to resolve the discrepancy by adjusting your Path
environment variable.
精彩评论