vb.net 在 Win 10 全新安装后,如何为 VS2015 安装 Office 互操作程序集?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31879375/
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
How can I install Office Interop Assemblies for VS2015 after a Win 10 clean install?
提问by MartinDuo
I have a Win10 clean install with VS2015 installed. I have Office 2010 for Home and Student. My VB.NET app's msi file was built in 2011 on a machine with Office 2000 installed, and it still works now to install my app in Win10. The installed app exports data to Excel and that still works.
我有一个安装了 VS2015 的 Win10 全新安装。我有适用于家庭和学生的 Office 2010。我的 VB.NET 应用程序的 msi 文件是在 2011 年在安装了 Office 2000 的机器上构建的,现在它仍然可以在 Win10 中安装我的应用程序。安装的应用程序将数据导出到 Excel 并且仍然有效。
Now I want to update the app with VS2015, but I get build errors, e.g.: Type 'Excel.Workbook' is not defined. I found out that I should load the Office Interop Assemblies.
现在我想用 VS2015 更新应用程序,但出现构建错误,例如:未定义类型“Excel.Workbook”。我发现我应该加载 Office Interop 程序集。
I downloaded and ran o2010pia.msi, but nothing showed up in "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Visual Studio Tools for Office" where I think they should live. Possibly the installation code is not yet recognizing VS2015 as Visual Studio 14.0?
我下载并运行了 o2010pia.msi,但在我认为它们应该存在的“C:\Program Files (x86)\Microsoft Visual Studio 14.0\Visual Studio Tools for Office”中没有任何显示。可能是安装代码还没有将 VS2015 识别为 Visual Studio 14.0?
In searching for answers, I found references to "PIAs in the GAC" and "reference a local copy of the PIAs in your source control tree". But I don't know what these mean!
在寻找答案时,我发现了对“GAC 中的 PIA”和“在源代码控制树中引用 PIA 的本地副本”的引用。但我不知道这些是什么意思!
How can I fix this?
我怎样才能解决这个问题?
回答by Bubu
I also missing Microsoft.Office.Interop.Excel.dllafter installing Win10.
Microsoft.Office.Interop.Excel.dll安装Win10后我也不见了。
I find it in
我在
"C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0__71e9bce111e9429c".
“C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0__71e9bce111e9429c”。
Maybe you can search it in C:\Windows\assembly.
也许你可以在C:\Windows\assembly.
回答by MartinDuo
I found a solution to my problem. I had spent days googling around for answers about missing PIAs and error messages about .NET 3.5 not found. I tried many suggested workarounds, but none worked for me. But...
我找到了解决我的问题的方法。我花了几天的时间在谷歌上搜索有关缺少 PIA 的答案以及有关未找到 .NET 3.5 的错误消息。我尝试了许多建议的解决方法,但没有一个对我有用。但...
Because I have ReSharper from JetBrains installed, I stumbled upon this from a left-click on my project folder which shows a context menu with this link: "Optimize References..."
因为我安装了来自 JetBrains 的 ReSharper,所以我在我的项目文件夹上左键单击时偶然发现了这一点,该文件夹显示了一个带有以下链接的上下文菜单:“优化引用...”
So as an experiment, I clicked it. It ran and did whatever it does (besides reporting). I did nothing! Now my project builds, runs, and automates Office Excel just like it did before my Windows 10 and VS2015 upgrade.
所以作为一个实验,我点击了它。它运行并做它所做的一切(除了报告)。我什么也没做!现在,我的项目构建、运行和自动化 Office Excel,就像在我的 Windows 10 和 VS2015 升级之前一样。
Here's a reference: http://blog.jetbrains.com/dotnet/2012/01/03/optimizing-assembly-references-with-resharper-61/. Hope this helps somebody.
这是一个参考:http: //blog.jetbrains.com/dotnet/2012/01/03/optimizing-assembly-references-with-resharper-61/。希望这可以帮助某人。
回答by David Bowman
Just had the same issue after an upgrade from Windows 7 to 10. I resolved it by bringing up the references, writing down the path to the Microsoft.Office.Interopt.Excel.dll, removing the reference, re-adding it, then rebuilding the project.
从 Windows 7 升级到 10 后刚遇到同样的问题。我通过调出引用、记下 Microsoft.Office.Interopt.Excel.dll 的路径、删除引用、重新添加它,然后重建来解决它该项目。

