简体   繁体   中英

How can I install Office Interop Assemblies for VS2015 after a Win 10 clean install?

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.

Now I want to update the app with VS2015, but I get build errors, eg: Type 'Excel.Workbook' is not defined. I found out that I should load the Office Interop Assemblies.

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?

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!

How can I fix this?

I also missing Microsoft.Office.Interop.Excel.dll after installing Win10.

I find it in

"C:\\Windows\\assembly\\GAC_MSIL\\Microsoft.Office.Interop.Excel\\15.0.0.0__71e9bce111e9429c".

Maybe you can search it in C:\\Windows\\assembly .

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

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

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.

Here's a reference: http://blog.jetbrains.com/dotnet/2012/01/03/optimizing-assembly-references-with-resharper-61/ . Hope this helps somebody.

从Windows 7升级到10后,也遇到了同样的问题。我解决了这一问题,方法是调出引用,写下Microsoft.Office.Interopt.Excel.dll的路径,删除引用,重新添加,然后重建该项目。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM