简体   繁体   English

使用Visual Studio 2017安装项目为C#Windows窗体创建Exe / MSI

[英]Creating Exe/MSI for C# Windows Forms using Visual Studio 2017 Setup Project

I'm trying to create exe/msi for my solution 我正在尝试为我的解决方案创建exe / msi

it contains the following Projects 它包含以下项目

项目清单

  1. ActiveDirectoryEngine: library used to implement AD operations ActiveDirectoryEngine:用于实现AD操作的库
  2. ADService: windows service - performs the work in the background ADService:Windows服务-在后台执行工作
  3. CryptographyEngine: library used to encrypt/decrypt data CryptographyEngine:用于加密/解密数据的库
  4. TerranovaActiveDirectoryHost: Dashboars/win form to manage/check the service's status TerranovaActiveDirectoryHost:仪表板/获胜表单,用于管理/检查服务状态
  5. SyncToolSetup: the setup project "it only targets TerranovaActiveDirectoryHost" SyncToolSetup:安装程序项目“仅针对TerranovaActiveDirectoryHost”

Here is the contents of the Setup project: 这是Setup项目的内容:

申请文件夹

用户的桌面文件夹

用户程序文件夹

I tried the same steps for different Solution, with ONLY one windows forms application, and it worked fine, but it looks that it doesn't work when I have more than one referenced projects. 我对不同的解决方案尝试了相同的步骤,仅使用一个Windows窗体应用程序,但效果很好,但是当我有多个引用的项目时,它似乎不起作用。

The install and Uninstall options are not enabled 未启用安装和卸载选项

建立后

Update: 更新:

all the previous projects are referenced in the Win forms project, so am I targeting the right one when creating the exe/msi? Win窗体项目中引用了以前的所有项目,因此在创建exe / msi时我是否要针对正确的项目?

参考资料

The only project with the Install option is the setup project. 带有“安装”选项的唯一项目是安装项目。 Other projects in the solution do not have install option just because there is a setup project as part of the solution. 解决方案中的其他项目没有安装选项,只是因为有一个安装项目作为解决方案的一部分。

References in a non-setup project (such as a C# build) are not automatically included in a setup project. 非安装项目(例如C#构建)中的引用不会自动包含在安装项目中。 References used to build code are not necessarily things that need installing on the target system. 用于构建代码的引用不一定需要在目标系统上安装。 The setup will try to help with dependencies, but it's unreliable, and only a guide. 该安装程序将尝试帮助解决依赖关系,但这是不可靠的,仅是一个指南。 For example, your Application Folder view contains some files that are part of the .NET Framework, and you definitely don't install them because they are installed as part of the standard .NET framework install. 例如,您的“应用程序文件夹”视图包含一些.NET Framework的文件,由于它们是作为标准.NET Framework安装的一部分安装的,因此您绝对不要安装它们。

The setup project must be told what needs to be installed on the target system. 必须告知安装项目在目标系统上需要安装什么。 There are generally two ways of doing this: 通常有两种方法可以执行此操作:

  1. Selecting project output as input to the setup project. 选择项目输出作为设置项目的输入。 This can be rather indeterminate because it's not always obvious what files are included, or what to do if the files need installing to different locations. 这可能是不确定的,因为并不总是清楚地包括了哪些文件,或者如果文件需要安装到不同的位置该怎么办。

  2. Add the files that you know you need one at a time by adding them in the File System view of the directory they need installing into. 通过一次将所需的文件添加到需要安装到的目录的“文件系统”视图中,来添加它们。 Typically, executables go into the Application Folder (defaults to Program Files..), data files to User's Application Data, shared files to Common Files folder, some assemblies to the GAC and so on. 通常,可执行文件进入“应用程序文件夹”(默认为“程序文件..”),数据文件进入“用户的应用程序数据”,共享文件进入“通用文件”文件夹,某些程序集进入GAC,依此类推。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用C#Windows窗体在Visual Studio中创建新页面 - Creating new pages in Visual Studio using C# Windows Forms 如何使用 c# 在 Visual Studio 2017 中为 1 个 selenium 项目创建 .exe 文件,其中包含多个类 - how to create .exe file in visual studio 2017 for 1 project of selenium using c# having multiple class within it C#Visual Studio安装程序设置项目输出为一个.exe - c# visual studio installer setup project output as one .exe 使用Visual Studio 2017的C#(xamarin.forms)警告 - Warning in C# (xamarin.forms) using visual studio 2017 C# - 获取安装项目 msi/exe 文件的版本 - C# - Get version of Setup project msi/exe file 如何使用C ++非托管库在Visual Studio 2017中为Xamarin.Forms设置项目? - How to setup project in Visual Studio 2017 for Xamarin.Forms with C++ unmanaged library? 在Visual Studio 2015中使用C#为Windows独立应用程序创建exe - Creating an exe for a Windows standalone application using C# in Visual Studio 2015 一个c#项目(MS Visual Studio)中有2个表单或窗口 - 2 forms or windows in one single c# project (MS visual studio) 从WinForms C#项目创建.exe或MSI - Creating .exe or MSI from WinForms C# Project C#-使用Visual Studio安装项目安装时,在LocalSystem下运行的Windows Service提示输入凭据 - C# - Windows Service running under LocalSystem is prompting for credentials when installing using Visual Studio setup project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM