miguel5655 Posted September 24, 2013 at 07:43 AM Report #525637 Posted September 24, 2013 at 07:43 AM Boas pessoal. É assim estou a fazer um projeto em que preciso de usar uma DLL. Como é para enviar depois para um cliente estava a tentar incorporar a DLL no exe para assim se tornar mais fácil. Tentei com vários exemplos que encontrei na internet, mas não consegui. Penso que a DLL esteja toda desenvolvida em vb.net, mas não tenho a certeza. A última solução que me ocurreu de forma ocultar um bocado a DLL que é utilizada foi alterar o nome da DLL. Alterei o nome fiz novamente a referência e a aplicação dá o mesmo erro de quando tentava fazer o Load da mesma através dos resources. O erro é o seguinte: The call stack contains only external code. You need to turn off Just My Code and load symbols in order to view source for this location. TypeInitializationException was unhandled. The type initializer for *********** threw an exception. Alguém me consegue ajudar ??
miguel5655 Posted September 24, 2013 at 07:58 AM Author Report #525639 Posted September 24, 2013 at 07:58 AM Mudar o nome da DLL e utilizar já consegui. Vou tentar novamente incorporar a DLL no exe.
miguel5655 Posted September 24, 2013 at 08:19 AM Author Report #525644 Posted September 24, 2013 at 08:19 AM (edited) Estou a fazer assim para colocar a DLL no exe final.No startup invoco esta Function: Private Function ResolveAssemblies(sender As Object, e As System.ResolveEventArgs) As Reflection.Assembly Dim ressourceName = "*****." + New AssemblyName(e.Name).Name + ".dll" Using stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(ressourceName) Dim assemblyData(CInt(stream.Length)) As Byte stream.Read(assemblyData, 0, assemblyData.Length) Return Assembly.Load(assemblyData) End Using End Function Coloquei a DLL nos resources e nas references, escolhi a opção False no copy local. Acontece-me o mesmo erro. Posso não estar a colocar corretamente a variável ressourceName . Estando a DLL nos resources qual seria o caminho correto ?Obrigado Edited September 24, 2013 at 02:51 PM by ribeiro55
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now