Private references As New Dictionary(Of String, Reflection.AssemblyName())
Private Sub ListAllReferencedAssemblies(ByVal asm As Reflection.Assembly)
Dim name As String = asm.GetName.Name
If Not references.ContainsKey(name) Then
references(name) = asm.GetReferencedAssemblies()
For Each asmName As Reflection.AssemblyName In asm.GetReferencedAssemblies()
ListAllReferencedAssemblies(Reflection.Assembly.ReflectionOnlyLoad(asmName.FullName))
Next
End If
End Sub
references.Clear()
Me.ListAllReferencedAssemblies(Me.GetType.Assembly)
For Each asm As String In references.Keys
Console.WriteLine("assembly {0} has these references:", asm)
For Each asmName As Reflection.AssemblyName In references(asm)
Console.WriteLine(vbTab & asmName.Name)
Next
Next
? The code I posted finishes within a few milliseconds.Yes, we discussed that, but unfortunatly that would cost me too much running time.
Are you talking about unused references? If so I think you may be confusing loaded assemblies with references.Uh, what about altering the way I am building the dlls? Is there a way to possibly include all references in a dll when building in 2008?
? The code I posted finishes within a few milliseconds.
Are you talking about unused references? If so I think you may be confusing loaded assemblies with references.
So the only way to see what goes on in an AppDomain is to run the app, or load the assembly into the current executing domain, or create a new domain and load the assembly there.help said:Represents an application domain, which is an isolated environment where applications execute.
What is an AppDomain?
So the only way to see what goes on in an AppDomain is to run the app, or load the assembly into the current executing domain, or create a new domain and load the assembly there.
AppDomain.GetAssemblies is not about references, it is about assemblies that are actually loaded in the domain at the current time of execution.
I still don't see what relevance an unused design-time reference has. If it is so crucial for you to include this in the type information why not actually use a type in the assembly? You only need a variable declaration to do that. Also since this is about design-time references why don't you just read the project file?
No, it was only suggested as a possibility to find additional reflection loaded assemblies at runtime (after they are actually loaded), since it was unclear what you were doing, and that you were indicating a use for types not declared in code.Can I get all the unused references using the AppDomain.GetAssemblies? Is this even practical? I really would just love the compiler to include them when compiling the dll so that the GetReferencedAssemblies would pull them back.
Yes, MS deployment reads the project file and includes all files specified.Does anybody know if Microsoft deployment will do this?
No, it was only suggested as a possibility to find additional reflection loaded assemblies at runtime (after they are actually loaded), since it was unclear what you were doing, and that you were indicating a use for types not declared in code.
The compiler doesn't include these references because no part of the compiled code is using them. So why are these assemblies even referenced in source project?
Yes, MS deployment reads the project file and includes all files specified.
Well, I not argue more about this, but if any part of your code uses a type from a referenced assembly then that assembly will be included in the GetReferencedAssemblies list, if not is has no place in the compiled assemblys type systembecause I need to use the base and the base needs to use these projects.
Are you kidding? Project files along with other source files are never deployed with the compiled assemblies they produce. When compiled the application is finished in the development process, after deploying it to client the user can run the exe and have fun with the application you wrote. In basic terms the development and deployment process:How does this work if the project files aren't included as part of the running system.
Well, I not argue more about this, but if any part of your code uses a type from a referenced assembly then that assembly will be included in the GetReferencedAssemblies list, if not is has no place in the compiled assemblys type system![]()
Are you kidding? Project files along with other source files are never deployed with the compiled assemblies they produce. When compiled the application is finished in the development process, after deploying it to client the user can run the exe and have fun with the application you wrote. In basic terms the development and deployment process:
A: write code, VS save in text file.
B: compile, VS reads the text file and make the binary assembly, for example an exe file.
C: deploy, copy the exe (usually by a proper installer) to client system.
D: client can consume the application by executing the exe.
![]()
No. When not used they remain project references that can only be packaged from the project meta sources, but they are not assembly references.My problem is that the GetReferencedAssemblies isn't pulling all the references listed in my project because some aren't used. I wanted to know if there is a way to retrieve those reference names from the dll OR if they aren't included in the dll is there a way to force the compiler to include them?