VSTO: Can't create workbooks - c#

When I try to create a Excel or Word workbook project in VS, I get the message:
A compatible version of Microsoft
Office is not installed on this
computer. You must install the
version of Office that is compatible
with your project. In addition,
repair the version of the Visual
Studio Tools for Office runtime that
is appropriate for your project by
running the installation program and
selecting the Repair option. The
runtime is available at the Microsoft
Download Center.
I have VS 2008 and Office 2003 Professional SP 3 installed. I did a full install of Office,
and it looks like the Interop DLLs are in the GAC. I am creating an Office 2003 project. I tried the steps from VSTO problem - cannot create visual studio excel workbook project. I repaired VS 2008 from the disk after installing Office 2003 Pro. I had Office 2003 Standard installed earlier, but I removed it before installing Office 2003 Pro. I am able to create add-ins. Any ideas?

Office 2k3 Standard is not compatible with VSTO; upgrading from 2k3 standard has likely left something in your registry.
This thread suggests that even moving to 2k7 doesn't give compatibility in this case! How about creating a new user profile?

The following steps worked:
1) Unistall Office Pro, reboot and reinstall.
2) Repair VS 2008 from disk.

I was also having the same prob but I installed office2003 sp3 and now its working fine

Related

How to develop an excel 2010 VSTO on a machine with excel 2013?

I am developing an Excel 2010 VSTO project - my deploy machines have Excel2010 setup which can't be upgraded (production machines).
My development machine has Excel 2013 (again, due to IT I can't downgrade it to Excel 2010).
How can i develop such a project?
Trying to run the Excel 2010 VSTO project (from VS, either release or Debug) gives me an error message...
You cannot debug or run this project, because the required version of the Microsoft Office application is not installed.
and after clicking OK, i receive:
Unable to start debugging. Operation not supported. Unknown error: 0x80070057.
It is possible to develop a VSTO project against a later version of Office than that installed on the target systems. In order to do so, the project must base on .NET Framework 4 or later. Choose the project template for the version of Office installed on the development machine.
Set "Embed interop types" to True for all the Office libraries referenced in the project. This will make the object libraries version-independent.
It's also important to not use any functionality introduced after the earliest version of Office being targeted. If the code tries to use functionality introduced in Excel 2013, for example, this code cannot run in Excel 2010.
For more information see https://learn.microsoft.com/en-us/visualstudio/vsto/running-solutions-in-different-versions-of-microsoft-office?view=vs-2017 and https://learn.microsoft.com/en-us/visualstudio/vsto/designing-and-creating-office-solutions?view=vs-2017

VSTO add-in for Outlook 2016

I have a vsto add-in for outlook developed in Visual Studio 2010 (.NET 4.0), but now when I tried to add this add-in for Outlook 2016 it is showing invalid vsto add-in. My question is:
Can the VSTO solution developed in Visual Studio 2010/12 support in Outlook 2016?
If not then what's the alternate or if yes then what I am doing wrong here?
A VSTO add-in should be installed on the machine. At least you need to add the required windows registry entries to load the add-in, you can't just add it. See Registry Entries for Application-Level Add-Ins and Registry Entries for VSTO Add-ins for more information.
My question is 'Can the vsto solution developed in Visual Studio 2010/12 support in Outlook 2016?'
Yes, it can. See Running Solutions in Different Versions of Microsoft Office. It states the following:
Microsoft Office applications can also run solutions created by using previous versions of Visual Studio. In some cases, these solutions require different versions of the Visual Studio Tools for Office runtime. Different versions of the Visual Studio Tools for Office runtime can be installed side-by-side on the same computer.
I'd suggest creating an installer which can check for preprequsites if any, add the required windows registry keys and install the plug-in on the system.
You may find the following articles helpful:
Deploying an Office Solution by Using Windows Installer
Deploying an Office Solution by Using ClickOnce

Microsoft.Office.Interop.Word reference in Visual Studio 2015 and MS Office 2016

I have Visual Studio 2012 Update 1 and office 2010, a git CV system, and an autobuild system based on TeamCity Enterprise. There is a project that contain references to "Microsoft.Office.Interop.Word".
On a new workplace I have installed VS 2015 (update 1) and MS Office 2016. This gave an issue type or namespace 'Office' not found in Microsoft.
I then deleted old references and add new references "Microsoft Office 16.0 Object Library" and "Microsoft Word 16.0 Object Library".
Now, in new Visual Studio 2015 project compiles OK. But the .csproj-file that has been changed is not compiling on other programmers computers, that have VS 2012 or VS 2013.
Is there a way to combine both references for different Office versions?
Alternatively, how can I configure this moment so that it would work fine on all workplaces? Can I just copy old .dll (from Office 2010) to a my computer and add it to project as outer .dll? Or is it bad idea?
Always program against the oldest version of Word (any Office program) that your solution needs to support. Something compiled against version 2016 isn't going to run against 2010 and you might end up using functionality not available in the older version.
It is possible to embed the interop information in your solution, making it PIA version independent (look up "embed interop types" - you need to activate that option for the PIA reference), but the problem with using unsupported functionality remains!

Development of Office 2016 Add ons

I have already developed Oulook Add on using Visual Studio 2010 with VSTO
It works for OFFice 2007, 2010 and 2013
Now Office 2016 has been released. is the same application will work for 2016?
Is there any changes in VSTO and PIA Version for Office 2016? is those has been released?
if not when will be released? is there any web page to track the release?
If any, Whether i need to install those?
Appreciated for getting a development guidance in Office 2016
It doesn't matter what PIA version you use in the project. The add-in should work correctly until you use members introduced in newer Office versions. Read more about that in the Running Solutions in Different Versions of Microsoft Office article.
Note, you can use the late-binding technology for accessing properties, methods and events in newer Office versions even when using older PIAs. See Type.InvokeMember .
There is no separate installer for Office 2016 PIAs. You can install them as a part of Office 2016. See How to: Install Office Primary Interop Assemblies for more information.

PowerPoint version compilation

Let's say I am using SharpDevelop/VS to develop an app that uses PowerPoint.
Do I need to recompile the app so there is a build for each version of MS Office?
I have MS Office 2007, but I would also like the app to work with Office 2003 and later, without having to recompile the app for each version.
Do I just need to install the appropriate Office Interop redistributable package/msi on the client machine, and ship my app as is?
Thanks in advance for your help.
If you're using the Microsoft.Office.Interop libraries you just need the 2007 version, it will be backwards compatible with older docs
I have found that you should build against the oldest MS Office you have. We still use MS Office 2000.
The the thought behind this:
Everything MS Office 2000 can do any later version of MS Office can do.
A lot of things MS Office 2007 can do is impossible to do in earlier versions
of MS Office.
I absolutely agree with Nifle. Use the OLDEST ones you can find. If you use 2007, there is a very good chance it will not work with older versions.
Since I did not want to install the oldest Office version on my development PC, I used Virtual PC to create a "final build" environment. I develop with my regular PC then move the source files over to the Virtual PC with Office 2003 and VS installed, and create the final customer build there.
You will need to edit the CSPROJ file to reference the older Office libraries with this method. You can do that by just opening VS on the build virtual PC, removing the references to Office and adding them again.
Just to confirm this with anybody that is trying this. I have a .NET 4 project that references the 15.0 PowerPoint Interop library and the Office 15.0 library (Office 2013). I setup the project to "Embed the Interop Types".
I setup a virtual machine with Office 2007 Ultimate on and ran the application (without copying any additional DLLs). It correctly interacted with PowerPoint to extract the data my application was looking for.
The Interop libraries are backwards compatible from my experience.

Categories