Cannot find Microsoft.Office.Interop Visual Studio - c#

I am developing an application which will send emails using C#. The app will be able to use templates for mail, among other things. The problem is I'm having trouble finding any Office.Interop references, which means I cannot work with Outlook.
Office is installed on my computer, but I've also tried to install the PIA from this link http://www.microsoft.com/en-us/download/details.aspx?id=3508. Unfortunately, this didn't change anything: When I launch the MSI it stops without a word, and I don't know if that is part of the problem.

Look for them under COM when trying to add the references. You should find the reference below, and possibly Microsoft Outlook 15.0 Object Library, if you need that. There are similar libraries for Word, Excel, etc.:
Update: The Object Library should contain the Interop stuff. Try to add this to a source file and see if it can now find what you need:
using Microsoft.Office.Interop.Outlook;

I forgot to select Microsoft Office Developer Tools for installation initially. In my case Visual Studio Professional 2013 and also 2015.

If you're using Visual Studio 2015 and you're encountering this problem, you can install MS Office Developer Tools for VS2015 here.

With Visual Studio 2015 I have activated it with the following steps.
Programs and Features --> Select Visual Studio > Change
Choose Modify
Windows and Webdevelopment --> Tick/select "Microsoft Office Developer Tools"
Start Update
It should work now.

You can find it at link:
C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Word\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Word.dll
Browse it then add references

If you have installed latest Visual studio and want to
To locate library of Microsoft.Office.Interop.Outlook or any other Microsoft.Office.Interop library then you should look into below 2 folders:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office14
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office15
Please note that folder could be C:\Program Files\

I think you need to run that .msi to install the dlls. After I ran that .msi I can go to (VS 2012) Add References > Assemblies > Extensions and all of the Microsoft.Office.Interop dlls are there.
On my computer the dlls are found in "c:\Program Files(x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA" so you could check in a similar/equivalent directory on yours just to make sure they're not there?

You need to install Visual Studio Tools for Office Runtime Redistributable:
http://msdn.microsoft.com/en-us/library/ms178739.aspx

I had the same issue with Visual Studio Community 2013, I fixed it downloading and installing the latest update of Office Developer Tools for Visual Studio 2013. Now I am able to see the whole Microsoft.Office.Interop.* list when I go to
Add References > Assemblies > Extensions
you can download it from here:
https://www.visualstudio.com/en-us/news/vs2013-update4-rtm-vs.aspx#Office
http://aka.ms/OfficeDevToolsForVS2013

Just doing like #Kjartan.
Steps are as follows:
Right click your C# project name in Visual Studio's "Solution Explorer";
Then, select "add -> Reference -> COM -> Type Libraries " in order;
Find the "Microsoft Office 16.0 Object Library", and add it to reference (Note: the version number may vary with the OFFICE you have installed);
After doing this, you will see "Microsoft.Office.Interop.Word" under the "Reference" item in your project.

Related

Missing Create GUID in Visual Studio Enterprise 2017?

Where can I find Create GUID options in Visual Studio 2017?
I'm using Visual Studio Enterprise 2017 Edition and I'm not finding the Create GUID options from the Tools menu.
Please follow troubleshoot section in this documentation.
https://social.technet.microsoft.com/wiki/contents/articles/33047.create-guid-tool-in-visual-studio.aspx
If the tool does not appear under the Tools menu, click Tools >
External Tools (see image above). It may be that the tool was not
registered correctly within the IDE. Using the External Tools window,
we can add a reference to guidgen.exe.
Mine was in Microsoft Visual Studio 11.0 instead of the Microsoft Visual Studio
Under c:\program files (x86) there are several MVS folders and each with a Common7 folder and some with Tools folder.
In one of then guidgen.exe is hiding.
Replace the links from Tools -> External Tools -> Create GUID, for example in my case
c:\program files (x86)\Microsoft Visual Studio 11.0\Common7\Tools
This is pretty late but nowadays with the C# REPL built into VS.NET or the numerous online REPLs a new guid is only as far away as a single line of C#:
Guid.NewGuid();

How create installer with Visual Studio Express 2013? [duplicate]

I already have a project which is ready to build. Currently, I am using visual studio 2013.
But, I don't know how to create an MSI setup in visual studio 2013, but for visual studio 2010 there are plenty of tutorials out there discussing how to create a setup in visual studio 2010.
Does this mean I need to install visual studio 2010 in order to create an application setup for my project?
What is the easiest way to create an application setup in visual studio 2013?
Microsoft has listened to the cry for supporting installers (MSI) in Visual Studio and release the Visual Studio Installer Projects Extension. You can now create installers in VS2013, download the extension here from the visualstudiogallery.
visual-studio-installer-projects-extension
As of Visual Studio 2012, Microsoft no longer provides the built-in deployment package. If you wish to use this package, you will need to use VS2010.
In 2013 you have several options:
InstallShield
WiX
Roll your own
In my projects I create my own installers from scratch, which, since I do not use Windows Installer, have the advantage of being super fast, even on old machines.
Visual Studio 2013 now supports setup projects. Microsoft have shipped a Visual Studio extension to produce setup projects.
Visual Studio Installer Projects Extension
Microsoft recommends to use the "InstallShield Limited Edition for Visual Studio" as replacement for the discontinued "Deployment and Setup Project" - but it is not so nice and nobody else recommends to use it. But for simple setups, and if it is not a problem to relay on commercial third party products, you can use it.
The alternative is to use Windows Installer XML (WiX), but you have to do many things manually that did the Setup-Project by itself.
Microsoft also release the Microsoft Visual Studio 2015 Installer Projects Extension This is the same extension as the 2013 version but for Visual Studio 2015
Apart from Install Shield and WiX, there is Inno Setup. Although I haven't tried it myself I have heard good things about it.
I will tell , how i solved almost similar problem. I developed a application using VS 2013 and tried to create wizard for it failed to do. Later i installed premium VS and tried and failed.
at last i used "ClickOnce" and it worked fine.
So i believe here also , "CLICKONCE" would help you.

How to add reference `Microsoft.TeamFoundation.TestImpact.Client.dll` in Visual Studio 2012?

I'm writing a customized activity for TFS build process workflow, e.g. guideline here.
The post requires to add reference to Microsoft.TeamFoundation.TestImpact.Client.dll at path C:\Windows\assembly\GAC_MSIL\Microsoft.TeamFoundation.TestImpact.Client\10.0.0.0__b03f5f7f11d50a3a. I cannot find this path on my machine installing Visual Studio 2012.
Where would I find this reference?
This is an old thread, but in case anyone else runs into this, just download the stand alone TFS Object Model installer.
As the other answer states, it's shipped with VS 2010 so you'll need to install that and then you should be able to find it.
For any of you trying to do this with VS 2013 / TFS 2013 you need Microsoft.TeamFoundation.TestImpact.Client version=12.0.0.0
This file is located in the folder
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.TeamFoundation.TestImpact.Client\v4.0_12.0.0.0__b03f5f7f11d50a3a
Version 10.0 of the file is shipped with Team Explorer or Visual Studio 2010.
It is copied directly to the GAC but you can extract it using the command line COPY command.
Install VS 2010 on your machine, open a command prompt and navigate to C:\Windows\GAC_MSIL\Microsoft.TeamFoundation.TestImpact.Client\{Version}\
Then COPY Microsoft.TeamFoundation.TestImpact.Client.dll to a folder of your choice.
Finally, my advice would be that you use the version included in VS 2012, that would make things much easier. The method described above also works for Microsoft.TeamFoundation.TestImpact.Client.dll 11.0 (aka VS 2012 version).

Add Microsoft.Office.InterOp.Word using reference C#

I'm trying to add the Microsoft Office InterOperability reference to my header but I cannot find it.
I went here: http://msdn.microsoft.com/en-us/library/kh3965hw.aspx
I installed the PIAs but I cannot find the reference still. There is a registry entry in the Add and Remove Programs but for some reason Visual Studio 2010 is not seeing it.
Edit: I have Visual C# 2010 Express
Visual Studio will install these Office PIA files as well to the following:
When you install Visual Studio, the PIAs are automatically installed to a location in the file system, outside of the global assembly cache. When you create a new project, Visual Studio automatically adds references to these copies of the PIAs to your project. Visual Studio uses these copies of the PIAs, instead of the assemblies in the global assembly cache, to resolve type references when you develop and build your project.
These copies of the PIAs help Visual Studio avoid several development issues that can occur when different versions of the PIAs are registered in the global assembly cache.
Visual Studio installs these copies of PIAs to the following locations on the development computer:
%ProgramFiles%\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office14
(or %ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office14 on 64-bit operating systems)
%ProgramFiles%\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office15
(or %ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office15 on 64-bit operating systems)
Did you include the Office files when installing Visual Studio?
If not, then run Visual Studio setup again and choose to Add Options and choose the Office PIA relevant pieces.

How to reference Microsoft.Office.Interop.Excel dll?

I had developed a system that deals with excel sheets in 2006 using MS VS 2005. Now, I can not use the same reference with MS VS 2012.
var app = new Microsoft.Office.Interop.Excel.Application();
Workbooks wbs = app.Workbooks;
Use NuGet (VS 2013+):
The easiest way in any recent version of Visual Studio is to just use the NuGet package manager. (Even VS2013, with the NuGet Package Manager for Visual Studio 2013 extension.)
Right-click on "References" and choose "Manage NuGet Packages...", then just search for Excel.
VS 2012:
Older versions of VS didn't have access to NuGet.
Right-click on "References" and select "Add Reference".
Select "Extensions" on the left.
Look for Microsoft.Office.Interop.Excel.(Note that you can just type "excel" into the search box in the upper-right corner.)
VS 2008 / 2010:
Right-click on "References" and select "Add Reference".
Select the ".NET" tab.
Look for Microsoft.Office.Interop.Excel.
You can also try installing it in Visual Studio via Package Manager.
Run Install-Package Microsoft.Office.Interop.Excel in the Package Console.
This will automatically add it as a project reference.
Use is like this:
Using Excel=Microsoft.Office.Interop.Excel;
If you have VS 2013 Express and you cant find Microsoft.Office namespace, try this ('Microsoft Excel 12.0 Object Library' if you want to use Office 2007)
Building off of Mulfix's answer, if you have Visual Studio Community 2015, try Add Reference... -> COM -> Type Libraries -> 'Microsoft Excel 15.0 Object Library'.
Instead of early binding the reference, there's an open source project called NetOffice that abstracts this from your project, making life much easier. That way you don't have to rely on your users having a specific version of Office installed.
NetOffice Codeplex site.
You have to check which version of Excel you are targeting?
If you are targeting Excel 2010 use version 14 (as per Grant's screenshot answer), Excel 2007 use version 12 . You can not support Excel 2003 using vS2012 as they do not have the correct Interop dll installed.
Go to Visual Studio Installer under Individual Components and click 'Office Developer Tools for Visual Studio. This solved it for me after lots of headaches.

Categories

Resources