次の方法で共有


Managed Satellite DLLs for Extensibility

As you may know, some extensibility (both Add-in and VSIP Packages) features now support storing resources in managed Satellite DLLs. But we have had a few comments that people have not been able to get this to work. In all cases it turned out that the Satellite DLL could not be loaded, either because the DLL was not in the correct location, or because the DLL was not properly created (problems with version numbers, etc). The following code is very similar to the code we use inside of VS to locate a Satellite DLL. Simply create a C# console app, past in the following code, change the pathToAssembly to point to either the Add-in or Package DLL, change lcid to your locale (1033 is en-US), and it will tell you if your Satellite DLL can be found or not.

static void Main(string[] args)
{

try
{
string pathToAssembly = @"...";
int lcid = 1033;
System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom(pathToAssembly);
System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(lcid);
System.Reflection.Assembly assemblyForResources = asm.GetSatelliteAssembly(culture);
}
catch (System.IO.FileNotFoundException fnf)
{
Console.WriteLine("File not found: " + fnf.FileName);
return;
}
Console.WriteLine("Satellite DLL found.");
}

Comments

  • Anonymous
    December 17, 2005
    FYI: I believe the most common problem is the use of strong named addin assemblies.

    If you sign your addin assembly and follow the al.exe instructions in Chetan Chudasama's blog, you will end up with a satellite assembly that cannot be loaded by the test code above, or by Visual Studio. This is because even if you sign the assembly the version mismatch will cause it to fail to load.

    The trick is to add the /template:<addin assembly> option to the al.exe invocation. In this way the version number is picked up from the main assembly.
  • Anonymous
    September 18, 2006
    Hi Craig,

    This must be answered somewhere. How do we create a satellite dll with custom bitmaps for toolbar buttons for an addin, that can be used by all locales?

    Thanks,
  • Anonymous
    May 06, 2009
    hi what's benefits of satellite dlls and how we can create that by add-in inn c# do visual stduio2008 contains visio or no? thanks a lot my email:ali.hallafi@gmail.com