Mike Murphy
Mike Murphy

Reputation: 940

vbc.exe exited with code -2146232797

I am moving a solution with multiple projects to VS 2015. The base project builds just fine in VS 2013. But when I try to build in VS 2015 I get the error below.

C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5): error MSB6006: "vbc.exe" exited with code -2146232797.

Need help please

Upvotes: 8

Views: 9338

Answers (12)

nickles80
nickles80

Reputation: 1101

I encountered this error when I had a post build event that was throwing an error. There was no indication this was the problem, just the -2146232797 error.

So check this in the property pages of the project. Go to Compile -> Build Events ... and check the Post-build event command line field. I suppose this might happen with a Pre-build event so check that as well.

Upvotes: 0

Robert Perry
Robert Perry

Reputation: 1956

I've just had this same issue. Mine was caused by having a class that had an event inside. I'd referenced this in another class as a shared property. The shared property was causing the compiler to fail. I removed the "shared" declaration and it compiles fine now

Upvotes: 0

greg
greg

Reputation: 1873

Apologies for the second answer, but this one is much simpler. I got the error again in a different project 8 days after last time.

This time, I started the day by giving a better name to a class. I had a class named conversionFactors and I renamed that class to constants to better represent what the class held.

Immediately got the error vbc.exe" exited with code -2146232797. SizingEngine

tracked it down to this line. I should have used the rename utility. yes. No argument. The compiler should also be more robust. Tsk tsk Microsoft.

Imports cf = SizingEngine.conversionFactors

so steps to reproduce 1. create a new project 2. create a class named Foo 3. create a class named Bar

  1. in Bar, add the following line

    imports bar_ = project1.NoClassByThisNameExists

  2. click f5

  3. listen for pac man wilting sound

ps - VS does not report any updates ready for download today. Im sure this will get fixed at some point.

Upvotes: 1

greg
greg

Reputation: 1873

I started getting this immediately upon installing vs2015 due to a licensing disagreement w/ MS , which I lost. :-(

Freshly back to work, i encounter this issue.

I tried doing the NUGET suggested by Brien King. Problem persisted. I tried doing the KN suggested by Teodor Constantinescu. Problem persisted.

I tried a new trivial web app and things were fine, so I did not uninstall vs2013 or vs2015.

I chose to back up my project (3 times, once on a usb stick i put in the other room) and delete groups of files and compile after each group was pulled out. Ultimately, when I got close to the end (nearly an empty project) it compiled.

By adding groups of files back, I identified the single file that causes this issue. I can recreate the issue by uncommenting a single line.

Further commenting out code, I isolated the problem to 4 lines of code. Beautiful. Explanation is this...

I have 2 web references that reference ssrs

THese are currently defined in my project as SSRS_reportservice2010 and SSRS_ReportExecution2005

I struggled getting these to work, so over time i had different names as i deleted and readded the web references. (Padawan)

For whatever reason, a file that was EXCLUDED, got INCLUDED today (2013--> 2015 issue, or greg mouse farting issue? we will never know)

In that (mistakenly included) file, there was a pair of old references

'1 Imports SSRS_ReportingService2010
'2 Imports SSRS = SSRS_ReportingService2010
'3 Imports SSRS_ReportExecution
'4 Imports SSRS_E = SSRS_ReportExecution

Line 1 used to reference the WS now named in my app as SSRS_reportservice2010 You can unComment that and things compile and run. Note that you do get a warning that you are referencing an empty namespace.

Line 2 is of course an alias to the long name, because I am an extremely lazy typer, plus I insist my code be readable and long names stink IMHO.

Line 2, if uncommented , cause vbc error -2146232797 Note that uncommenting 2 , or 1 & 2 cause the error. Its something about the bad alias that causes compiler upchuck.

Repeat the above discussion with lines 3 and 4 which have to do with the webservice currenlty named SSRS_ReportExecution2005

So there you have it. This took me 8 hours to debug. hope it helps someone.

Many of the other posts, comments, etc also mention Import/Using Statements. The root bug probably lies somewhere in there.... (yes, this is a bug in the compiler)

PS - one thing that was interesting is that the offending file's name started w/ a W so was one of the first to come out.
Nothing improved when I took that file out of the project all together.

I can not explain why the app did not compile as soon as I took the offending file out. I can offer that I took the webservices out very late in the process, I just didnt think they were the issue.

It baffles me that the file could be gone and I was still getting the issue when I can now simply comment out 4 lines and things work perfectly.

Upvotes: 1

Pawan Pillai
Pawan Pillai

Reputation: 2065

I fixed the issue by opening all my .vb files are removing extra imports. Do this for all files and then rebuild. This should work.

Upvotes: 1

J1mak0s
J1mak0s

Reputation: 29

In my case, I found that an import was causing the issue. Specifically, after trying a lot of other suggestions, removing the Microsoft.Office.Interop.Excel import from a file, finally got my project to built.

Upvotes: 2

Teodor Constantinescu
Teodor Constantinescu

Reputation: 68

After trying both Microsoft.Net.Compilers -version 1.1.1 and KB3110221, my solution was still failing to compile with the same error. Only later I noticed that the error was accompanied by a warning which was letting me know that one of the libraries referenced by the solution was compiled against .NET Framework 4.5.2 while my solution was compiling against .NET Framework 4.5. I recompiled the said library against .NET Framework 4.5 and the solution compiled fine.

Now that my issue was solved after trying three fixes, I can't tell whether the last one alone would have done, but I hope it'll be of help.

Upvotes: 1

natidea
natidea

Reputation: 31

This issue is resolved in the latest Visual Studio 2015 servicing update. The relevant download is KB 3110221 which is discussed in this KB article.

Upvotes: 2

PavlinII
PavlinII

Reputation: 1083

I had the same issue after installing Update 1 to VS 2015.

I've download Microsoft.Net.Compilers NuGet package as Brien King suggested in his answer. This fixed the issue for one project. And then:

"c:\Program Files (x86)\MSBuild\14.0\Bin\vbc.exe" had version 1.1.0.51109 ...userprofile.nuget\packages\Microsoft.Net.Compilers\1.1.1\tools\vbc.exe had higher version 1.1.0.51202

So I've copied entire "1.1.1\tools" directory into "14.0\Bin" directory and overrided 27 existing files.

This fixed it for all projects. Remember to create backup before you do this.

Upvotes: 1

wags1999
wags1999

Reputation: 865

I had a large solution that was failing to build after updating to VS 2015 Update 1 RTM. In my case, there were a number of warnings of

Namespace or type specified in the Imports '<import name>' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

that occurred right before "vbc.exe" crashed. Once I removed those extra, unnecessary Imports, the solution build correctly.

Upvotes: 3

Brien King
Brien King

Reputation: 366

I talked with MS Tech Support. It's a confirmed bug in the VB compiler. They say it will be fixed in the next update.

In the mean time the work around is to install a Nuget package.

Please follow these instructions to install Nuget package.

  1. Open the affected project in Visual Studio

  2. Open the Package Manager Console (Tools -> NuGet Package Manager -> Package Manager Console)

  3. Run:

    Install-package Microsoft.Net.Compilers -version 1.1.1
    

Upvotes: 7

David BS
David BS

Reputation: 1892

The problem may be related with some utilized function in .NET Framework. Try to change the project framework to 4.0 and see if the problem persists.

Upvotes: -1

Related Questions