2

I installed Office 2013 and VS2013 on Windows 8.1 - when I now open old Projects which reference the version 12 PIAs (for Office 2007) these are missing in the references since VS2013 does only install Version 14 and 15 of the PIAs.

Since I want to Keep using PIA 12 I do not want to change the references. Instead I'd like to Register the Version 12 PIA's with VS2013. How can I achieve this?

I already tried using the PIA redistributable, but it does not want to work unless I install Office 2007, too (which I don't want). I can get a copy of the dlls from some other system, but how do I register These with Visual Studio 2013 (I don't need them in the GAC, I think, just in VS2013).

As far as I know for the PIA some COM class ID's should be recorded, I just don't know how/which.

Edit:

Right now the PIA dlls are referenced just by Name and Fingerprint/public key (no hint path). When I open the reference Panel in VS2013 they will Show up, can be selected and work. They seem to be registered somewhere so VS2013 can find them. I just want to replicate this on other Computers.

Kara
  • 6,115
  • 16
  • 50
  • 57
Sam
  • 28,421
  • 49
  • 167
  • 247
  • You are not thinking ahead. You don't stand a chance to diagnose and fix a bug in your code when your client uses Office 2007 unless you have that version installed as well. Either change your prerequisites and demand the user updates his Office version or install the Office version you need to provide support. – Hans Passant Dec 12 '13 at 15:45
  • This is just one computer of the several who share this source. And I neither need nor want Office 2007 on every computer, since I'll have to debug other versions, too. – Sam Dec 12 '13 at 15:54
  • The funny thing is: When I install VS2008 these old PIAs will be registered in VS2013 even without having Office 2007 installed. But I don't want to install a full fledged old VS I don't need just for the PIAs. There must be a way to register them without having to install lots of other stuff. – Sam Dec 13 '13 at 09:12
  • Doesn't [the answer to this question](http://stackoverflow.com/q/370407/2065121) tell you everything? Or did I misunderstand? – Roger Rowland Dec 23 '13 at 10:21
  • Roger, as I wrote right above your comment, one of my other development Computers has the Office 2007 PIAs installed and registered but had never Office 2007 installed, so that answer obviously not complete (since some older VS can install them, there sure must be a way to do this, I'm just missing the 'how'). – Sam Dec 23 '13 at 15:05
  • (I just noticed a part that might be misunderstood: Even though I don't have Office 2007 installed, I do have Office 2013 installed - I just Need those PIAs for the older Version to compile my stuff) – Sam Dec 23 '13 at 15:55

1 Answers1

4

I've got the exact same setup, a machine with Windows 8.1 and only Office 2013 installed. No trouble at all getting the Office 2007 PIAs installed. Do beware that this is a two-step process. After you downloaded PrimaryInteropAssembly.exe from the Microsoft server and started it, you prompts you to give a directory to store intermediate files. Navigate to that directory, right-click the o2007pia.msi file and select Install to get them actually registered.

It isn't the only way to get them onto your machine. If you have another machine with the PIAs installed then create a dummy project and add the references to the Microsoft.Interop assemblies you need. Select them and ensure that the "Embed Interop Types" property is set to False and the "Copy Local" property is set to True. Build the project, you'll get the interop assemblies in the bin\Debug directory. Copy them to your machine and use the Browse button to add a reference to them. You always want the "Embed Interop Types" property set to True in your real project so you don't have to deploy the PIA on your user's machine anymore. Check them in with your project so you don't lose them again.


UPDATE: PIAs are obsolete since .NET 4.0 and VS2010. Check this post for the details.

Community
  • 1
  • 1
Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • When I run o2007pia.msi I get an error "Please install Microsoft Office 2007 before installing this product" (O2013 is installed). Copying the files locally would work but I'd need to change the projects and as I wrote above the source is shared between several computers, so this is not a good option. – Sam Dec 26 '13 at 20:53
  • Sigh, this is going to require pulling teeth. Well, we now have a documented install attempt and an error message, what else don't we know? What's specially about this 2013 version? Is it 64-bits? – Hans Passant Dec 26 '13 at 22:52
  • 1
    @Sam `Copying the files locally would work but I'd need to change the projects and as I wrote above the source is shared between several computers, so this is not a good option` - why is it not a good option? When the other devs/PCs change Office versions wouldn't it be better to have the ref's in source control so no others bump into this problem? what part of the project would you need to change? – Jeremy Thompson Dec 27 '13 at 03:54
  • @Hans, it's a surface pro 2 updated to win8.1. Office is 2013 prof plus, 32-Bit, standard install. VS2013 is standard install, too. So there should be nothing special about this, at least nothing I know of. – Sam Dec 27 '13 at 07:36
  • @Jeremy Well, at least I don't think it's a good option to break the working setup on several other computers because one has a problem. Don't you? – Sam Dec 27 '13 at 08:03
  • @Sam This is what I dont understand, if several PC's with different Office versions can check out one code base and compile then that would be better and wont break the build. Please correct me on how you're determining the other working setups would fail. Perhaps I'm not understanding something eg Ref's to DLL's in GAC or something? – Jeremy Thompson Dec 27 '13 at 08:36
  • A Surface Pro is certainly rather special. What's unusual about it is that Office comes pre-installed on it with a minimum foot-print to not take up too much precious disk space. No idea what kind of shortcuts they took to get there. What the PIA installer needs is the ability to *update* the registry keys for an existing Office install, clearly it doesn't it see such a key. Can you even automate the 2013 version? – Hans Passant Dec 27 '13 at 08:52
  • @Hans, I uninstalled the pre-installed demo Office and installed a full Office 2013 Premium Plus instead. The PIA libs for Office 2013 are installed and do compile and work. – Sam Dec 27 '13 at 08:56
  • 1
    @Jeremy Right now the PIA dlls are referenced just by Name and Fingerprint/public key (no hint path). When I open the reference Panel in VS2013 they will Show up, can be selected and work. They seem to be registered somewhere so VS2013 can find them. I just want to replicate this on other Computers. – Sam Dec 27 '13 at 08:58