MSBuild compilation build error

I get an error compiling a VB.NET project using the MSBuild command line. Work from devenv works fine:

error BC30518: Overload resolution failed because no accessible 'Invoke' can be called with these arguments: 

Corresponding line:

  Windows.Application.Current.Dispatcher.Invoke(Sub() InteractionManager.Current.DisplayException((DirectCast(e.ExceptionObject, Exception)))) 

Why does MSBuild prohibit this when DevEnv / Visual Studio is not? And why is this a problem at all? I'm fine. The only thing that I see interesting on this line is that Invoke accepts a Delegate object (not a strongly typed delegate) ... so in C # I could not use the lambda expression, where I am now in VB.NET ( I needed to do something like a new Action (() => ...)

+4
source share
1 answer

I believe that you are mixing .NET versions.

System.Windows.Threading.Dispatcher has one argument overload of the Invoke method in .NET 4.5. In .NET 4.0 or later, all available overloads take two or more arguments, which then exit the system and give an error message.

Therefore, I assume that the executed devenv is VS2012 beta, while msbuild is something more conditional.

You should be able to resolve the mismatch by adjusting the Path environment variable.

0
source

All Articles