Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# DLL In VBA Application
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01442835
Message ID:
01442879
Vues:
34
>>I'm trying to use a C# DLL in a MS Access project.
>>
>>
>>using System;
>>using System.Collections.Generic;
>>using System.Linq;
>>using System.Text;
>>
>>namespace AccessTest
>>{
>>    public class Test1
>>    {
>>        public string GetHello()
>>        {
>>            return "Hello";
>>        }
>>    }
>>}
>>
>>
>>I have "Register for COM interop" checked.
>>
>>1) When I build, there is no .tlb file being created.
>>2) When I run regasm,.exe, it crashes:
>>
>>
>>Unhandled Exception: System.TypeInitializationException: The type initializer fo
>>r 'RegAsm.RegAsm' threw an exception. ---> System.IO.FileNotFoundException: Coul
>>d not load file or assembly 'Regcode, Version=1.0.3300.0, Culture=neutral, Publi
>>cKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find t
>>he file specified.
>>File name: 'Regcode, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7
>>f11d50a3a'
>>   at RegAsm.RegAsm..cctor()
>>
>>WRN: Assembly binding logging is turned OFF.
>>To enable assembly bind failure logging, set the registry value [HKLM\Software\M
>>icrosoft\Fusion!EnableLog] (DWORD) to 1.
>>Note: There is some performance penalty associated with assembly bind failure lo
>>gging.
>>To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus
>>ion!EnableLog].
>>
>>   --- End of inner exception stack trace ---
>>   at RegAsm.RegAsm.Main(String[] aArgs)
>>
>>
>>I need to get this to work. Anyknow know what's happening?
>
>Firstly : Mark your class with the [ClassInterface(ClassInterfaceType.AutoDual)] attribute.
>Secondly: What is the name of the assembly and what is the syntax that you used for RegAsm? (sounds like it didn't find the DLL)


Ok, I marked it.

I ran RegAsm like this:
RegAsm C:\Projects\Test\AccessTest\bin\Debug\AccessTest.dll /tlb:AccessTest.tlb
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform