How can I point to older .NET assemblies for intellisense?

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 13 years ago by Craig - Varigence, Inc.
Version: 11.1.0545
I have a WPF/C# application that references .NET 4.0 assemblies. However, within the application is a syntax editor that needs to display C# intellisense tied to .NET 3.5 assemblies.

Is there a recommended way to have the ProjectAssembly's AssemblyReferences point to .NET 3.5 assemblies (or at least, assemblies older than the latest ones in the GAC)?



[Modified at 10/31/2011 05:14 PM]

Comments (3)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Craig,

If you know the specific folder where those versions are located, you can load them directly. Or you can just load pre-cached reflection data for them that perhaps you set up on your own computer.

The next version has a new section added to the Assemblies documentation topic that talks about how to do that. If you want to see it now, it's in the Silverlight Studio 2011.2 documentation for the add-on. As a side note, the features described there may or may not work in 2011.1, but will work in the upcoming 2011.2 version.

[Modified at 11/01/2011 12:00 PM]

Actipro Software Support

Posted 13 years ago by Craig - Varigence, Inc.
I looked through the Assemblies topic in Silverlight Studio 2011.2 but I'm still not clear on how to use it. If you're referring to the Loading Pre-Defined Binary Assembly Cache Data section, your sample mentions using a resourceStreamName. However, I'm unclear as to where that name is supposed to come from.

Also, as to loading assemblies from a specific folder, can you clarify how I can do that? Will that work even if never versions of the assemblies are in the GAC?

Note that for most assemblies, I've managed to solve this by using Assembly.ReflectionOnlyLoadFrom(). While this technique prevents code from being executed in the assembly, it seems like it doesn't matter since we're only using these assemblies to populate completion lists.

The one exception here is mscorlib. While I can load a reflection only assembly of mscorlib, I can't add it to the AssemblyReferences collection. When I do, .NET throws an exception: System.TypeLoadException: Could not load type 'System.Object' from assembly 'mscorlib, Culture=neutral, PublicKeyToken=b77a5c561934e089' because the parent does not exist.

[Modified at 11/01/2011 12:55 PM]
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
The resourceStreamName is the path to the resource file. So if you open your assembly in Reflector and look at the Resources section, you can see what it is. It's the same sort of thing as if you embed a .landef as an embedded resource in your app. You can refer to the MSDN to learn more about embedded resources and their paths if you need further help there.

An example of loading a specific file is:
That call effectively does an Assembly.ReflectionOnlyLoadFrom in our code.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.