Where to copy DLL files when publishing a C# project

I am trying to publish an application written in VS2008. It needs 2 DLL files added to the application folder. The project builds and runs fine in the IDE but after publishing it won't run and when debugged it says it can't find the 2 DLLs. Where exactly are they supposed to be located?

Thanks in advance for your help.
kylebocaAsked:
Who is Participating?
 
Sujith_NairCommented:
kyleboca, I fail to understand if you are using Inno Setup and not the InstallShield setup (that comes with  Visual Studio) why are you hesitant in trying out ISTool

see the attached screenshots on how to automatically instruct the destination directory while installation.

These setting and lot more settings become far more easy to be managed and access if you use ISTool.

The contsants to be used in ISTool and InnoSetup are

{app}  
The application directory, which the user selects on the Select  Destination Location page of the wizard.
For example: If you used  {app}\MYPROG.EXE on an entry and the user selected "C:\MYPROG" as the  application directory, Setup will translate it to "C:\MYPROG\MYPROG.EXE".

{sys}  
The system's System32 directory (System on Windows 95/98/Me).
For example:  If you used {sys}\CTL3D32.DLL on an entry and the system's Windows  System directory is "C:\WINDOWS\SYSTEM", Setup or Uninstall will translate it to  "C:\WINDOWS\SYSTEM\CTL3D32.DLL".
On 64-bit Windows, by default, the System32 path returned by this constant  maps to the directory containing 32-bit system files, just like on 32-bit  Windows. (This can be overridden by enabling 64-bit mode.)


{syswow64}  
On 64-bit Windows, the system's SysWOW64 directory, typically  "C:\WINDOWS\SysWOW64". This is the actual directory in which 32-bit system files  reside. On 32-bit Windows, 32-bit system files reside in "System32" or "System",  not in a separate SysWOW64 directory, so this constant will resolve to the same  directory as {sys} if used there.
Do not use this constant unless you have a specific need to obtain the name  of the actual directory in which 32-bit system files reside. Gratuitously using

{pf}  
Program Files. The path of the system's Program Files directory.  {pf} is equivalent to {pf32} unless the install is running in  64-bit mode, in which case it is  equivalent to {pf64}.

ISTool-help--0-.gif
ISTool-help--1-.gif
ISTool-help--2-.gif
ISTool-help--3-.gif
List-of-Destination-places.jpg
0
 
Sujith_NairCommented:
hi! there , if you have kept those Dlls in the app directory/folder while publishing, try placing them in windows folders Windows or System or System32 folders. (Make sure you configure the installer to install the dll on the target machine on either of these places)

Any application when launched searches for the required resource/file in the following order of preference!
 Its own folder/directory
The Windows folder followed by System and System32 folder.

hope this was of some help...

regards,
Sujith.


0
 
kylebocaAuthor Commented:
I am using Inno Setup. I cannot determine how to install the DLLs using this.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
kylebocaAuthor Commented:
If I manually copy the DLLs to the system folder it will install and run just fine. I have never had to configure an installer to do this. I am unsure how to do this.
0
 
AshokCommented:
You can use SCRIPT as follows

[Setup]
AppName=My Program

[Files]
Source: "MYPROG.EXE"; DestDir: "{app}"
Source: "CTL3DV2.DLL"; DestDir: "{sys}"; Flags: onlyifdoesntexist uninsneveruninstall

where {sys} means to automatically copy in System directory.  See help file on how to use Script file in Inno.

HTH
Ashok
0
 
Sujith_NairCommented:
hi there.. if you haven't downloaded and installed Istool for Inno Setup I strongly advice you to download the same from here . Aslo install the script maker.

Istool makes it really fast and easy to configure various aspects of installation gives you better control !

Regards,
Sujith

0
 
Sujith_NairCommented:
please go through the help that comes with IStool , I am sure you wont be having any doubts left once you go through its quick and short help. it makes things really easy ! for every file that you add into project it gives you the option to select the target destination of file ! It has whole lot of functions that will make your work easier!
0
 
shadow77Commented:
Add ";  DestDir: {app}" (without the quotes) after your file name.  {app} represents your application folder.  Unless you intend your DLL to be shared, if you put it in {app}, it won't interfere with other applications.  For shared DLLs, add ";  DestDir: {app}".

I suggest you also look at InnoScript from Randem Systems (http://www.randem.com/innoscript.html).  I found it easier to use than ISTool, and the author is very knowledgeable and helpful if you have questions.
0
 
shadow77Commented:
Correction:  For shared DLLs, add ";  DestDir: {sys}".
0
 
MarkusLoiblCommented:
Just add the 2 dlls to your VS2008-project (no subdirectory), click on one of them in the VS 2008 project item, go to Properties, change:
Build action: none
Copy to output: copy always

Same with second.
then when building the 2 dlls are always part of the build output directory
0
 
kylebocaAuthor Commented:
Hi Markus.
That makes the most sense to me. I thought there had to be a way to do that.
So when the application is installed it will copy the DLLs to the system folder automatically?
0
 
MarkusLoiblCommented:
I'm not too familiar with the publish process.

Using a project with settings described above and then publish it within Visual Studio: Then the 2 DLLs should be installed (copied) in the same directory as your application, not the system dir.
0
 
kylebocaAuthor Commented:
Hi Sujith,
I am not familiar with some of the terminology used with Inno Setup and IS Tool. I am hoping to accomplish everything within VS2008 but will consider your options also. I will give it a try today.

Thank you very much for the detailed information and screenshots!!
0
 
kylebocaAuthor Commented:
I experimented with Inno Setup and IS Tool. I am unable to figure out the process. This is the first program that I have had to publish and add DLL's to a project.

Is there a way to accomplish this within VS2008?
0
 
kylebocaAuthor Commented:
I figured out. Thanks all for your help.
0
 
Sujith_NairCommented:
hi! kyleboca, in your comment (04/26/10 08:29 AM, ID: 32102836) you said you are using Inno setup.

If you are using Inno,( it is the most widely used and famous Setup used these days due to its obvious advantages of being an Open Source/freeware with lots of available plug-ins.)

  1. You should prepare the list of files to be included in your project (Images,dlls,exes,etc) you can use VS2008 to do prepare automated list.
  2. Open/launch the IStool.
  3. From the left pane,select the resource that you wish to be added.(Scripts,Files&Directories,Icons,Ini..etc)
  4. For eg you are adding Files& Directories,then on the right pane just right click>new Item
  5. Browse for the file and add you will see this Form.In the Dest Dir Field select {sys} to place your dll on system folder, the list of constants are included in Inno Setup's Help file.Please go though its help file to find all the constants available.
  6. When you are finished adding files go to Project>Compile setup (Ctrl+F9)
  7. You can test by running the setup (F5)
  8. Save the Setup.exe file and distribute it to your client.(after testing)
Inno setup creates a single Setup.exe file with all the files neatly placed inside. You have to take little efforts to get yourself customized with ISTool. belive me using ISTool is teh easier less complex way out for you.

Now, if you are willing to get it done from inside VS2008 follow this MSDN Article.

Unless you try it yourself and contribute your time and efforts ( like you did to learn VS2008 )
It will remain a mystery for you!
So start experimenting!

Happy2Help,
Sujith


0
 
kylebocaAuthor Commented:
Hi Sujith,
I have successfully created a deployment package using Inno Setup. Actually I was able to use the wizard within Inno Setup and it installs and runs fine.

Thank you very much for all of the time you spent posting in this thread.
0
 
Sujith_NairCommented:
yea! now I am glad that the spent time did bear some fruits :)
All The best and carry on experimenting and do go through its help files that comes with it! you will soon get accustomed with it!

Bye!
0
 
kylebocaAuthor Commented:
Hello Sujith,
I have a lot more questions about IS Tool and Inno Setup. Can we start a different thread or do you have an email address that I may email you directly?
Thanks in advance for your help.
Kyle
0
 
Sujith_NairCommented:
Hi ! Kyleboca...you can start a new thread, it will be attended by many more experts thereby making it a knowledgeable and fruitful experience !  post a link of  the new thread here , so that i can track it too, I am bit busy these days so pls bear with me for the delayed response !
0
 
kylebocaAuthor Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.