vb.net vbc.exe 退出,代码为 -2146232797

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33663168/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 19:33:35  来源:igfitidea点击:

vbc.exe exited with code -2146232797

vb.netvisual-studio-2015vbc

提问by Mike Murphy

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.

我正在将包含多个项目的解决方案移至 VS 2015。基础项目在 VS 2013 中构建得很好。但是当我尝试在 VS 2015 中构建时,出现以下错误。

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

C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.VisualBasic.Core.targets(56,5):错误 MSB6006:“vbc.exe”退出,代码为 -2146232797。

Need help please

需要帮助请

回答by Brien King

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.

我与 MS 技术支持人员进行了交谈。这是 VB 编译器中已确认的错误。他们说它将在下一次更新中修复。

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

与此同时,解决方法是安装 Nuget 包。

Please follow these instructions to install Nuget package.

请按照这些说明安装 Nuget 包。

  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
    
  1. 在 Visual Studio 中打开受影响的项目

  2. 打开包管理器控制台(工具 -> NuGet 包管理器 -> 包管理器控制台)

  3. 跑:

    Install-package Microsoft.Net.Compilers -version 1.1.1
    

回答by wags1999

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

我有一个大型解决方案在更新到 VS 2015 Update 1 RTM 后无法构建。就我而言,有许多警告

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.

这发生在“vbc.exe”崩溃之前。一旦我删除了那些额外的、不必要的导入,解决方案就会正确构建。

回答by J1mak0s

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.

就我而言,我发现导入导致了问题。具体来说,在尝试了很多其他建议之后,从文件中删除了 Microsoft.Office.Interop.Excel 导入,最终让我的项目得以构建。

回答by natidea

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

此问题已在最新的 Visual Studio 2015 服务更新中得到解决。相关下载KB 3110221这是在讨论这个知识库文章

回答by Teodor Constantinescu

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.2while my solution was compiling against .NET Framework 4.5. I recompiled the said library against .NET Framework 4.5and the solution compiled fine.

在尝试了 Microsoft.Net.Compilers -version 1.1.1 和KB3110221 之后,我的解决方案仍然无法编译并出现相同的错误。后来我才注意到错误伴随着一个警告,它让我知道解决方案引用的库之一是针对.NET Framework 4.5.2编译的,而我的解决方案是针对.NET Framework 4.5编译的。我针对.NET Framework 4.5重新编译了上述库,并且该解决方案编译得很好。

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.

现在我的问题在尝试了三个修复后解决了,我不知道单独最后一个是否可以解决,但我希望它会有所帮助。

回答by Pawan Pillai

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.

我通过打开我所有的 .vb 文件来删除额外的导入来解决这个问题。对所有文件执行此操作,然后重建。这应该有效。

回答by greg

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

由于与 MS 的许可分歧,我在安装 vs2015 后立即开始获得此信息,但我丢失了。:-(

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.

我尝试执行 Brien King 建议的 NUGET。问题依然存在。我尝试执行 Teodor Constantinescu 建议的 KN。问题依然存在。

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

我尝试了一个新的微不足道的网络应用程序,一切都很好,所以我没有卸载 vs2013 或 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.

我选择备份我的项目(3 次,一次在我放在另一个房间的 U 盘上)并删除文件组并在每组拉出后进行编译。最终,当我接近尾声时(几乎是一个空项目),它编译了。

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...

进一步注释掉代码,我将问题隔离到 4 行代码。美丽的。解释是这样...

I have 2 web references that reference ssrs

我有 2 个引用 ssrs 的网络引用

THese are currently defined in my project as SSRS_reportservice2010 and SSRS_ReportExecution2005

这些目前在我的项目中定义为 SSRS_reportservice2010 和 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)

无论出于何种原因,一个被排除的文件,今天被包括在内(2013--> 2015 问题,或 greg mouse 放屁问题?我们永远不会知道)

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.

第 1 行用于引用现在在我的应用程序中命名为 SSRS_reportservice2010 的 WS 您可以取消注释,然后编译和运行。请注意,您确实会收到一条警告,指出您正在引用一个空命名空间。

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.

第 2 行当然是长名称的别名,因为我是一个非常懒惰的打字员,而且我坚持我的代码是可读的,而且长名称恕我直言。

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.

第 2 行,如果取消注释,会导致 vbc 错误 -2146232797 请注意,取消注释 2 或 1 & 2 会导致错误。它是关于导致编译器upchuck的坏别名。

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

对与名为 SSRS_ReportExecution2005 的 web 服务当前有关的第 3 行和第 4 行重复上述讨论

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

所以你有它。这花了我 8 个小时来调试。希望它可以帮助某人。

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.

PS - 有趣的一件事是,违规文件的名称以 W 开头,因此是第一个出现的文件。
当我把那个文件一起从项目中取出时,没有任何改善。

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.

令我感到困惑的是,该文件可能会消失,而当我现在可以简单地注释掉 4 行并且一切正常时,我仍然遇到问题。

回答by greg

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.

为第二个答案道歉,但这个答案要简单得多。上次 8 天后,我在另一个项目中再次遇到错误。

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

这一次,我通过给一个班级取一个更好的名字来开始新的一天。我有一个名为conversionFactors的类,我将该类重命名为常量以更好地表示该类所包含的内容。

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

立即收到错误 vbc.exe”,代码为 -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.创建一个新项目 2.创建一个名为 Foo 的类 3.创建一个名为 Bar 的类

  1. in Bar, add the following line

    imports bar_ = project1.NoClassByThisNameExists

  2. click f5

  3. listen for pac man wilting sound
  1. 在 Bar 中,添加以下行

    进口 bar_ = project1.NoClassByThisNameExists

  2. 点击 f5

  3. 听 pac man wilting 的声音

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

ps - VS 今天没有报告任何可供下载的更新。我相信这会在某个时候得到解决。

回答by PavlinII

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

将更新 1 安装到 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:

我已经下载了 Microsoft.Net.Compilers NuGet 包,正如 Brien King 在他的回答中所建议的那样。这解决了一个项目的问题。进而:

"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

“c:\Program Files (x86)\MSBuild\14.0\Bin\vbc.exe”的版本为 1.1.0.51109 ...userprofile.nuget\packages\Microsoft.Net.Compilers\1.1.1\tools\vbc.exe更高版本 1.1.0.51202

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

因此,我已将整个“1.1.1\tools”目录复制到“14.0\Bin”目录并覆盖了 27 个现有文件。

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

这为所有项目修复了它。请记住在执行此操作之前创建备份。

回答by Robert Perry

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

我刚刚遇到了同样的问题。我的原因是有一个里面有一个事件的类。我在另一个类中将其引用为共享属性。共享属性导致编译器失败。我删除了“共享”声明,现在编译正常