使用公共依赖项设置具有两个主要输出的项目
我在 Visual Studio 中有一个包含 4 个项目的解决方案 - 2 个 Windows 窗体应用程序、一个类库和一个安装项目。
这两个 Windows 窗体应用程序都引用了类库项目。
我的安装项目包括两个 Windows 窗体应用程序的主要输出,检测到的依赖项包括类库。
我已将主要输出之一放在应用程序文件夹中,另一个放在子文件夹中。问题是类库程序集仅安装在应用程序文件夹目录中,但我还需要它在子目录中,否则 Windows 窗体应用程序之一将无法运行。我怎样才能让它安装在两个地方?是否可以不手动添加程序集?
I have a solution in visual studio with 4 projects - 2 windows form applications, a class library and a setup project.
The 2 windows forms applications both reference the class library project.
My setup project includes the primary outputs for both windows forms application, and the detected dependencies include the class library.
I've put one of the primary outputs in the Application Folder, and the other in a sub folder. The problem is that the class library assembly only gets installed in the application folder directory but I also need it in the sub directory, otherwise one of the windows form applications will not run. How can I get it to install in both places? Is it possible to do without manually adding the assembly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
简单的解决方案是将两个 .exe 安装在它们需要运行的 .dll 所在的文件夹中。如果需要,您可以将第二个 .exe 的快捷方式放在子文件夹中。
The easy solution would be to install both .exes in the same folder as the .dll they need to run. You could put a shortcut to the second .exe in a subfolder, if you want.
希望这仍然有意义。我就是这样做的。假设所有依赖项都已复制到项目的输出目录中:
Hope this is still relevant. This is how I did it. Assuming all the dependencies are copied to your projects' output directory:
非常简单:
对于每个需要引用一些程序集并在 2 个不同位置使用它们的安装项目,创建 2 个 MergeModuleProjects。
第一个包含有关其中一个程序集位置的文件系统,另一个包含有关另一个程序集位置的文件系统。那么您最初拥有的安装项目将仅引用 2 个 MergeModuleProjects。 设置项目与合并模块项目
示例:
Setup1 具有以下文件系统:
然后将上面的结构替换为以下结构:
Setup1 具有以下文件系统:(无)
Setup1 引用 MergeModule1 和 MergeModule2
MergeModule1 具有以下文件系统:
MergeModule2 具有以下文件系统:
Very easy:
For each setup project that needs to refference some assemblies and use each of them in 2 different locations, create 2 MergeModuleProjects.
The first one contains the file system regarding one of the assemby locations, the other one contains the file system regarding the other assembly location. Then the Setup project which you initially had will only refference the 2 MergeModuleProjects. setup project vs merge module projct
Example:
Setup1 has the following file system:
Then you replace the structure above with the following one:
Setup1 had the following file system: (none)
Setup1 refferences MergeModule1 and MergeModule2
MergeModule1 has the following file system:
MergeModule2 has the following file system: