Link to home
Start Free TrialLog in
Avatar of Arikkan
ArikkanFlag for United States of America

asked on

.Net Reflection

I have two different Solutions and all of them using VB.Net .NetFramework 4.7.1:
Solution1 (Running as Windows Service)
                Project with Name=Common, Output=dll, OutputFile=Common.dll, Version=1.1.2.31
                                NameSpace=Name1.NAMe2.Name3
                                                Class with Name=GlobalConstants
                                                                Enum defined in GlobalConstants=
{Public Enum CustomerStatus
                Active=1
                Inactive=2
}
                                                Class with Name=CommonFunctionsDA
                                                                MethodName=Method1 in class CommonFunctionDA
                Project with Name=CVRTimer, Output=exe, OutputFile=CVRTimer.exe, Version=1.0.0.0, References=”Common.dll v1.1.2.31”
                                NameSpace=Name1.Name4.Name5
                                                Class with Name=MOCVRTimer
                                                                                Method=
Public Sub SomeMethod()
                                                Load Assembly Reports.dll from Solution2 using Reflection
                                                Create Object of Type=CustomersReport
                                                Created Object of MethodInfo=Method8
                                                Invoke Method8 of CustomersReport
End Sub
 
Solution2(.Net Desktop Application)
                Project with Name=Common, Output=dll, OutputFile=Common.dll, Version=2.0.0.0
                                NameSpace=Name1.Name2.Name3
                                                Class with Name=GlobalConstants
                                                                Enum defined in GlobalConstants=
{Public Enum VoterStatus
                Active=1
                Inactive=2
}
                                                Class with Name=CommonFunctionsDA
                                                                MethodName=Method1 in class CommonFunctionDA
                Project with Name=Reports, Output=dll, OutputFile=Reports.dll, Version=1.0.0.0, References=”Common.dll v2.0.0.0”
                                Namespace=Name1.Name6.Name7
                                                Class with Name=CustomersReport
                                                                MethodName=Method8 in class CustomersReport which is calling CommonFunctionsDA.Method1
                                                                                Public Function Method8() As Boolean
                                                                                                Dim obj As New CommonFunctionsDA
                                                                                                Do some Work
                                                                                                Obj.Method1()
                                                                                                If SomeVariable=GlobalConstants.CustomerStatus.Active Then
                                                                                                                Some more work
                                                                                                End If
                                                                                                Return True
                                                                                End Function
                Project with Name=CVR, Output=exe, OutputFile=CVR.exe, Version=1.0.0.0, References=”Common.dll v2.0.0.0, Reports.dll”
                                NameSpace=Name1.Name8.Name9
                                                Class with Name=CVR
 
 
 
When I use Reflection to call a method (ObjectOfReports.Method2) of Reports.dll(in Solution2) through MOCVRTimer.exe (in Solution1) which is using a method (ObjectOfCommonVersionTwo.Method1) of Common.dll (v2.0.0.0) then also at runtime it will use the ObjectOfCommonVersion1.Method1 from Common.dll (v1.1.2.31)
How I can make sure that when I am call a method (ObjectOfReports.Method2) of Reports.dll(in Solution2) through MOCVRTimer.exe (in Solution1) then also it should use ObjectOfCommonVersionTwoDotZero.Method1 instead of ObjectOfCommonVersionOneDotOne.Method1 ?
 
ASKER CERTIFIED SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial