views:

402

answers:

3

Hello everybody,

I suddenly have a big problem I didn't have before.

In my current project, I want to add a reference to "Microsoft.Office.Interop.OneNote". When I open the .NET tab of the "Add Reference" dialog, the "Microsoft.Office" assemblies aren't available like they used to be; on my machine, the next assembly after "Microsoft.JScript" is called "Microsoft.SqlServer.ConnectionInfo"; no trace of any of the "Microsoft.Office" assemblies. I used to be able to do this under Windows XP, but made the switch to Windows 7 a couple of weeks ago. I don't know whether that has anything to do with it.

I already checked whether the assemblies are installed on my machine, but I found all of the office assemblies safe and sound in "windows\assembly". Oddly enough, the reference to "Microsoft.Office.Interop.OneNote" in a previous project continues to work; I just can't add any new references with the "add references" dialog, as they aren't shown in the list of .NET references anymore.

Any help will be appreciated.

Kind regards,

Rainer

A: 

Pardon the perhaps stupid question.

Have you installed MS Office since you switched from XP to windows 7?

I'm only asking because I forgot to install it after the same upgrade and I spent a good half hour last week trying to figure out why my project that used Powerpoint was complaining.

Nifle
Yes, I have installed MS Office 2007 right after the fresh Windows 7 install. It was pretty much the first software package that I installed after switching to Windows 7.
Rainer
A: 

Hi,

the content of the dialog you see with ´Add Reference´ is actually not loaded from the GAC. It´s some registry-folder settings for visual studio.

Maybe you installed in such a way that the libraries are not part of this set. Then VS will not show them in the dialog.

for more info on how to add entries to your ´add reference´ dialog see

http://support.microsoft.com/kb/306149

Marvin Smit
Thank you for the hint. I used the information from the link you gave me. I extended the registry with a key to "c:\Windows\assembly\" where the interop assemblies reside. Nothing changed.Any other ideas?
Rainer
A: 

I think I have got it. For the benefit of anyone who runs into the same problem, there was an interesting lesson to be learned about some lesser known features of Windows:

The link Marvin mentioned above...

http://support.microsoft.com/kb/306149

...says:

To display your assembly in the Add Reference dialog box, you can add a registry key, such as the following, which points to the location of the assembly

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyAssemblies]@="C:\\MyAssemblies"

where MyAssemblies is the name of the folder in which the assemblies reside.

So I did just that, replacing "myAssemblies" with "C:\Windows\Assembly".

Nothing happened.

I changed the value of the empty standard key to "C:\Windows\Assembly".

Nothing.

I tried some variations of the theme: double backslashes, ending with a backslash, the return of the son of the backslash. No cigar.

So I tried to work the other way around by trying to copy the necessary dll from c:\windows\assembly into one of the directories that are being watched by the "add reference" dialog. On my machine, these paths are conveniently listed under

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v2.0.50727\AssemblyFoldersEx]

When I tried to copy the dll from c:\windows\assembly, there was no "copy" option in the context menu. Drag'n'drop didn't work either. For this problem, I found several alternative solutions here:

http://geekswithblogs.net/pavelka/archive/2006/05/05/WindowsExplorerAndTheGlobalAssemblyCache.aspx

I opted for solution 2:

Add DisableCacheViewer Registry Key Another way to disable to create a new dword key under HKLM\Software\Microsoft\Fusion\ with the nane DisableCacheViewer and set it’s [DWORD] value to 1.

After I had done that, I could see the real directory structure below c:\windows\assembly; almost each and every dll has its own subdirectory. As soon as DisableCacheViewer was set, I could

  • traverse the real directory tree that was hidden under c:\windows\assembly
  • copy dlls and paste them to one of the directories listed under "AssemblyFoldersEx"
  • deduce the correct path to my dlls and create a fresh key to that path just below "AssemblyFoldersEx".

Thank you very much to everyone who answered, and a special thanks goes to hannes pavelka, whose blog entry helped to solve my problem.

P.S.: I'm almost certain that I never had to do this under Windows XP. IIRC, all of the interop assemblies were available without this kind of registry fumbling.

Rainer