Scott Solmer
Scott Solmer

Reputation: 3897

Include file dependencies in setup project

How do you make sure files from a project get included in the application directory created by an installer?

I have a DLL in my VB.NET (2010) project: TwinCAT.Ads.dll [has include] that has its own dependency: TcAds.dll [has no include anywhere in my project], which is Not a .NET assembly.

I got the compiler to make sure it spits TcAds.dll into the bin output folder when compiling by adding it as an existing item to my project, then setting it's build action to "Embedded Resource" and setting it to copy always to Output Directory.

Now that I'm ready to publish, I've made a windows setup project.
Please, no suggestions to use WIX or whatever, this is what I've got to work with.

The problem is that this outcast of a DLL does not appear as a dependency and therefore doesn't get included in the installer. After install, program runs, can't find DLL, bombs out.

Surely there must be a simple way to ensure whatever file you want gets included in the install directory?

Upvotes: 5

Views: 6688

Answers (1)

Atilla Ozgur
Atilla Ozgur

Reputation: 14721

You can add an arbitrary file to your setup project.

enter image description here

I created a setup project and added c++ ddl file to output. It has a following section in setup project file. You can easily add your dll file to your project in this way. If you need you can write post-build script to copy this file to suitable location so that setup project will find it.

"File"
        {
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_06335985DF0F4EF3A600861437AA6CDF"
            {
            "SourcePath" = "8:..\\Debug\\CppWin32.dll"
            "TargetName" = "8:CppWin32.dll"
            "Tag" = "8:"
            "Folder" = "8:_1E4113F2F81040508FD1CDA54F242F25"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
        }

see my build output.

------ Build started: Project: ConsoleApplication1, Configuration: Debug x86 ------
  ConsoleApplication1 -> P:\denemeler\setupDeneme\Setup1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe
------ Starting pre-build validation for project 'Setup1' ------ 
------ Pre-build validation for project 'Setup1' completed ------
------ Build started: Project: Setup1, Configuration: Debug ------
Building file 'P:\denemeler\setupDeneme\Setup1\Setup1\Debug\Setup1.msi'...
Packaging file 'CppWin32.dll'...
Packaging file 'ConsoleApplication1.exe'...
========== Build: 2 succeeded or up-to-date, 0 failed, 0 skipped ==========

Upvotes: 2

Related Questions