473,395 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Embedding .dll into app

maylortaylor
72 64KB
I have a console app that basically zips files using Ionic.Zip. I just built the exe file and it works just fine while it is in the 'Release' folder that it was built in. However, whenever i move the exe file from that folder it fails b/c the program is looking for the Ionic.Zip.dll file.

I found on Ionic's website a thread that explains how to embedd the dll file into the exe so you don't need to have the Ionic.Zip.dll file in the same folder as the exe for the program to execute. However, the method they use is a bit more advanced than I am used to.

So the question is...can anyone give me guidance on doing the steps listed in the last paragraphs linked below.

http://dotnetzip.codeplex.com/wikipa...Title=Examples

---EDIT----
Ok, i figured out the first part (Project > Add Existing Item...; then finding the file in the 'Solution Explorer' and changing the Build Action to "Embedded Resource)

But now my issue is figuring out the VB code to actually implement this change. They have C# on the above link and i'm absolutely awful at translating.
Dec 3 '12 #1
2 8056
PsychoCoder
465 Expert Mod 256MB
Normally I wouldnt just do the translation for you but I know you've put forth quite a bit of effort on this so here's the C# code translated to VB.NET for you :)

Expand|Select|Wrap|Line Numbers
  1. Shared Sub New() '   <--- this must be the name of your main class
  2.     AddHandler AppDomain.CurrentDomain.AssemblyResolve, New ResolveEventHandler(AddressOf Resolver)
  3. End Sub
  4.  
  5. Private Shared Function Resolver(sender As Object, args As ResolveEventArgs) As System.Reflection.Assembly
  6.     Dim a1 As Assembly = Assembly.GetExecutingAssembly()
  7.     Dim s As Stream = a1.GetManifestResourceStream("Ionic.Zip.dll")
  8.     Dim block As Byte() = New Byte(s.Length - 1) {}
  9.     s.Read(block, 0, block.Length)
  10.     Dim a2 As Assembly = Assembly.Load(block)
  11.     Return a2
  12. End Function
For future reference you can download and install an IDE called SharpDevelop (or #Develop) and it has a built-in code converter you can use.
Dec 4 '12 #2
maylortaylor
72 64KB
Thank you so much PsychoCoder. A Gentleman and scholar, you are.
Dec 4 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: jordi | last post by:
Hi, I'm starting to use Python embedded in a C program. I'm using Python to execute several scripts using as a variables information retrieved for several multithread "agents" written in C. ...
4
by: Alicia Haumann | last post by:
I accidentally sent this to webmaster@python.org, so this could be a duplicate if "webmaster" forwards it to this list. :{ Hi, there. Thanks for any help that can be offered. I've been...
2
by: Roose | last post by:
With some googling I have found these resources: http://docs.python.org/ext/win-dlls.html http://www.python.org/doc/faq/windows.html I have a large Win32/MFC/C/C++ application that has an...
0
by: smilechaser | last post by:
Hi All, A question about embedding: If I take the example code on embedding (Section 5.3 of Extending and Embedding the Python Interpreter 2.4) and add the lines: PyRun_SimpleString("import...
1
by: amit | last post by:
Hello, I am currently studying how to embedd python. I am developing a graphical C++ application. My goal is to embedd python script that will control some kind of animation. I have some...
1
by: Tommy Nordgren | last post by:
I want to write an application that embeds and extends (at least) the Python and Perl interpreters. Now i want to find as much as possible about the Python tools used for extending and embedding...
0
by: hq4000 | last post by:
Given AStyleSheet.xsl : <AStyleSheet> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.mytest.mytest2.mytest3.com" version="1.0"> <xsl:output method="xml"...
1
by: gavinpaterson | last post by:
Dear Pythoners, I am writing as I am having trouble embedding a Python program into a Win XP C++ console application. I have written a script file for importing and I am trying to use the...
6
by: Qun Cao | last post by:
Hi Everyone, I am a beginner on cross language development. My problem at hand is to build a python interface for a C++ application built on top of a 3D game engine. The purpose of this python...
0
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.