您可以将任意文件添加到安装项目中。
我创建了一个安装项目并将 c++ ddl 文件添加到输出。它在安装项目文件中有以下部分。您可以通过这种方式轻松地将您的 dll 文件添加到您的项目中。如果您需要,您可以编写构建后脚本将此文件复制到合适的位置,以便安装项目可以找到它。
"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:"
}
}
查看我的构建输出。
------ 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 ==========