.NET

Reply
Distinguished Contributor
jerry.bryant
Posts: 174
Registered: ‎10-23-2003
Message 1 of 8 (485 Views)

.NET DLL XP = YES....WIN7 = NO

485 Views, 7 Replies
01-22-2013 11:55 AM

AutoCAD 2011
Visual Studio 2010

A while back, we created an AutoCAD .NET DLL using VS 2010 and .NET Framework 4.0.
It ran fine on all the XP workstations.

Now we upgraded to WIN7 Stations....and the .DLL wont run.

Error message:

Unhandled exception has occurred in a component in your application. If you click Continue, the application will ignore this error and attempt to continue.

Retrieving the COM class factory for component with CLSID {88D969C0-F192-11D4-A65F-0040963251E5} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).....

Blah Blah Blah.......

Any suggestions on where to look first?....THX

Jerry Bryant
"Swing hard and hope you hit it!"
Moderator
Alexander.Rivilis
Posts: 1,417
Registered: ‎04-09-2008
Message 2 of 8 (482 Views)

Re: .NET DLL XP = YES....WIN7 = NO

01-22-2013 12:08 PM in reply to: jerry.bryant

Some questions:

1. Windows XP was 32-bits and Windows 7 is 64-bits?

2. Are you using COM (for example, Autodesk.AutoCAD.Interop or Autodesk.AutoCAD.Interop.Common)?

If answer is YES for both question then you can use appropriate version (64-bits) of COM-dll

 

P.S.: Also look like was not installed MSXML 4.0 Service Pack 3

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Distinguished Contributor
jerry.bryant
Posts: 174
Registered: ‎10-23-2003
Message 3 of 8 (472 Views)

Re: .NET DLL XP = YES....WIN7 = NO

01-22-2013 12:25 PM in reply to: Alexander.Rivilis

THX for the help....

1. XP was 32 Bit...WIN7 is 64 Bit
2. Yes....COM was used

So it sounds like I will need a 32 Bit (XP) version of the DLL, and a 64 Bit (WIN7) version of the .DLL
Seems like a PITA....

Is there a way to Compile a DLL that will work for both?
I thought that was a "feature" of .NET?

I guess I need to Open up the project, replace the References?...and re-compile???
Will this require some "recoding"?......I Supect so...

Jerry Bryant
"Swing hard and hope you hit it!"
Moderator
Alexander.Rivilis
Posts: 1,417
Registered: ‎04-09-2008
Message 4 of 8 (456 Views)

Re: .NET DLL XP = YES....WIN7 = NO

01-22-2013 01:51 PM in reply to: jerry.bryant

jerry.bryant wrote:
Is there a way to Compile a DLL that will work for both?


If you are using 32-bits COM library the answer is No.


jerry.bryant wrote:
I guess I need to Open up the project, replace the References?...and re-compile???
Will this require some "recoding"?......I Supect so...


Also you have to change options Platform target to x64. If you using P/Invoke you have to check function signature and entry point.

 

Some useful links:

 

Use 64 bit ActiveX component from a .NET assembly

Error "Problem in loading application" on 64 bit OS when using GetInterfaceObject

Where did my Interop assemblies go?

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 5 of 8 (440 Views)

Re: .NET DLL XP = YES....WIN7 = NO

01-22-2013 05:49 PM in reply to: jerry.bryant

jerry.bryant wrote:

Is there a way to Compile a DLL that will work for both?
I thought that was a "feature" of .NET?


Yes, that is a feature of .NET, provided that there is no dependence on native DLLs.

 

It is not a feature of ActiveX.

 

If the ActiveX control or server is native code, rather than managed .NET code, then it will require different builds for 32 and 64 bit platforms.

 

Distinguished Contributor
jerry.bryant
Posts: 174
Registered: ‎10-23-2003
Message 6 of 8 (420 Views)

Re: .NET DLL XP = YES....WIN7 = NO

01-23-2013 11:36 AM in reply to: DiningPhilosopher

I thought I understood the recommendation here...but I guess I dont.

So, how do you change the "build" to a 64 bit platform...

Jerry Bryant
"Swing hard and hope you hit it!"
Valued Mentor
AubelecBE
Posts: 394
Registered: ‎01-27-2010
Message 7 of 8 (400 Views)

Re: .NET DLL XP = YES....WIN7 = NO

01-24-2013 04:24 AM in reply to: jerry.bryant

Hi i have this issue when i work with PDFCREator. :


So i create a projet on VS2010 on Xp 32b --> the dll i use on xp 32 --> no prob but on seven 64b error. :smileyhappy:

So for use my dll on the both 32/64b :

in you projet :
1 - remove your COM.
2 - add the com and check is local is true.
3 - build you projet --> new file .ddl in you debug/release of you app.
4 - Rename this DDL with no . in the name.
5 - remove your com.
6 - add the com but not in the COM but Browse and select the file you have rename.
7 - build

Now on you all machin you have to convert the com with a exe on you machine :

 

here the main program you have to use :
on XP :
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\tlbimp.exe"
On Seven :
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\tlbimp.exe"

So : on DOS: the command you have to make :
tlpimp.exe "Path+Name of COM" /out:"Path+name of you DLL in you debug/release path"

replace the first in "" with your COM  
replace the last in "" with your DLL.

Dont remove the ""


i have too created a function for this : (sorry mu native language is french. So use a translator)

 '*************************************************************************************
    '*** Fonction de Vérification des fichiers InterOp (ex : PDFCreator) *****************
    '*************************************************************************************
    '== Entrée :
    '==    NomProg  : Le nom du programme qui utilisera l'InterOp
    '==    NomApp   : Le nom + path de l'application à charger
    '==    NomDll   : Le nom du fichier (avec le .DLL) (qui doit exister à coté du prog)
    '
    '==    FichierDeBase32 : Le fichier qui doit générer la DLL. (Exe ou autre)
    '==    FichierDeBase64 : Le fichier qui doit générer la DLL. (Exe ou autre)
    '==    
    '==    
    '== Sortie
    '==    NomFichier : Le chemin complet + le nom.dll du programme compilé sinon retourne ""
    '==    
    '==    
    '*************************************************************************************
    Public Function VerifieInterOp(ByVal NomProg As String, _
                                   ByVal NomApp As String, _
                                   ByVal NomDll As String, _
                                   ByVal FichierDeBase32 As String, _
                                   ByVal FichierDeBase64 As String) As Boolean
        Dim OkRetour As Boolean = False


        Dim NomFichierInterOp As String = NomApp.Remove(NomApp.LastIndexOf(NomProg)) & NomDll


        If Not (IO.File.Exists(NomFichierInterOp)) Then

            Dim NomFichierTLPImp As String
            Dim NomFichierBaseDLL As String
            If IntPtr.Size > 4 Then
                '64 bits
                NomFichierTLPImp = "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\tlbimp.exe"
                NomFichierBaseDLL = FichierDeBase64
            Else
                '32bits
                NomFichierTLPImp = "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\tlbimp.exe"
                NomFichierBaseDLL = FichierDeBase32
            End If

            Dim RetourProcess As System.Diagnostics.Process

            Try
                MsgBox("Le programme va essayer de créer le lien avec le programme : " & vbCrLf & _
                       NomFichierBaseDLL & vbCrLf & _
                       "Une fenêtre va s'ouvrir et le programme va attendre sa fermeture.", _
                       vbOKOnly & vbCritical, "Information")

                Dim ParamTxt = """" & NomFichierBaseDLL & """" & " /out:" & """" & NomFichierInterOp & """"
                RetourProcess = Process.Start(NomFichierTLPImp, ParamTxt)
                Do While RetourProcess.HasExited = False
                    GestionAUTOCAD.EcrireSurLigneDeCommande(vbCrLf & "En attente du programme de lien...")
                Loop

                GestionAUTOCAD.EcrireSurLigneDeCommande(vbCrLf & "Fin du programme de lien, analyse du résultat.")
                If RetourProcess.ExitCode = 0 Then
                    'vérification si le fichier existe
                    If IO.File.Exists(NomFichierInterOp) = False Then
                        MsgBox("Le fichier " & NomFichierInterOp & " n'a pas été créé" & vbCrLf & _
                             "Contacter le responsable pour vérifier ce problème.", _
                                 vbOKOnly & vbCritical, "Erreur de Programmation")
                        GestionAUTOCAD.EcrireSurLigneDeCommande(vbCrLf & "Programme : " & NomFichierTLPImp)
                        GestionAUTOCAD.EcrireSurLigneDeCommande(vbCrLf & "Paramêtre : " & ParamTxt)
                        Return False
                    Else
                        Return True
                    End If
                End If
                Return False

            Catch ex As Exception
                MsgBox("Le programme de lien InterOP " & NomFichierTLPImp & "est introuvable." & vbCrLf & _
                       "Contacter le responsable pour vérifier le bon répertoire." & vbCrLf & vbCrLf & _
                              "", vbOKOnly & vbCritical, "Erreur de Programmation")
                Return False
            End Try
        Else
            Return True
        End If

    End Function

 


And this is for call this function for create the interop.DLL for PDFCREATOR.

If VerifieInterOp("GestionFolio", Str, _
                                 "PdfCreator.dll",
                                 "C:\Program Files\PDFCreator\PDFCreator.exe", _
                                 "C:\Program Files (x86)\PDFCreator\PDFCreator.exe") = True Then
                Assembly.LoadFrom(Str)
                '--> Ajouter un espace à la fin de la commande
                Application.DocumentManager.MdiActiveDocument.SendStringToExecute(strCmd, True, False, True)
            Else
                MsgBox("Pour lancer le programme GestionFolio, il faut absolument" & vbCrLf & _
                       "installer PdfCreator dans le répertoire : " & vbCrLf & _
                       "C:\Program Files\PdfCreator\         (sous XP 32Bits / Seven 32Bits)" & vbCrLf & _
                       "C:\Program Files (x86)\PdfCreator\   (sous XP 64Bits / Seven 64Bits)", _
                       MsgBoxStyle.Information, "Erreur d'installation")
            End If

 the var STR is the path + name of my application i have build with VS2010.

 

GestionAUTOCAD.EcrireSurLigneDeCommande(...
is a sub for write on the console (replace ed. ....)

you have to put this code in another application if you use the COM on the init of you app.

Me i use before declare  the var  = new clsPDFCreator.Pdfcreator.


You have to put the InterOpDLL with your Application in the same path.

 

I think it is a best way for build a InterOp valid on 62 / 64 b.

 

with this i dont have you error.

 

 Only tested with PDFCREATOR.

Distinguished Contributor
jerry.bryant
Posts: 174
Registered: ‎10-23-2003
Message 8 of 8 (372 Views)

Re: .NET DLL XP = YES....WIN7 = NO

01-28-2013 06:23 AM in reply to: AubelecBE

OK..I got it working....

Had to remove the COM XML reference and replace with the .NET System.Xml...
Then was able to figure out the 1000 changes to the code....the "GUI Suggestions" worked in most cases...the others I just luckily guessed right......"InnerXml" was the key change....

Thanks for all the suggestions...

Jerry Bryant
"Swing hard and hope you hit it!"
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.