C# 如何使用一些文件创建setup.exe?

C# 如何使用一些文件创建setup.exe?,c#,visual-studio-2015,icons,exe,setup-project,C#,Visual Studio 2015,Icons,Exe,Setup Project,我开发了c windows窗体项目,需要部署。 首先,我使用setup factory作为解决方案。 但是,我无法更新出现在控制面板上的图标 其次,我在VisualStudio中使用了安装向导项目。 但是,我无法更新setup.exe图标 那么,如何使用完全自定义创建setup.exe , 创建test.nsi文件并粘贴到下面的脚本中,然后使用NSIS编译器打开该文件,并编译生成所需的setup.exe test.nsi 可能重复我检查过的方法,也在工作,但我不能使用我的图标,因为颜色更新到较低

我开发了c windows窗体项目,需要部署。 首先,我使用setup factory作为解决方案。 但是,我无法更新出现在控制面板上的图标

其次,我在VisualStudio中使用了安装向导项目。 但是,我无法更新setup.exe图标

那么,如何使用完全自定义创建setup.exe

, 创建test.nsi文件并粘贴到下面的脚本中,然后使用NSIS编译器打开该文件,并编译生成所需的setup.exe

test.nsi


可能重复我检查过的方法,也在工作,但我不能使用我的图标,因为颜色更新到较低的比蒂认为,安装wizad不是我的项目的好解决方案,是否有其他解决方案创建setup.exe与完全自定义?如果你需要安装程序,你可以尝试例如inno setup我完全同意vik_78。Inno安装程序是一款受欢迎、功能丰富、易学的安装程序,与其他安装程序相比,它对于简单的安装更为直接。
BrandingText " "
!define setup "./main_setup.exe"
 
; change this to wherever the files to be packaged reside
!define srcdir "."
 
!define company "Company Name"
 
!define prodname "Program Name"
!define exec "main.exe"
 
# optional stuff
 
; Set the text which prompts the user to enter the installation directory
 DirText "Test"
 
; text file to open in notepad after installation
!define notefile "license.txt"
 
; license text file
 !define licensefile license.txt
 
; icons must be Microsoft .ICO files
 !define icon "edf.ico"
 
; installer background screen
#!define screenimage splash.png
 
; file containing list of file-installation commands

 
; file containing list of file-uninstall commands
; !define unfiles "unfiles.nsi"
 
; registry stuff
 
!define regkey "Software\${company}\${prodname}"
!define uninstkey "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}"
 
!define startmenu "$SMPROGRAMS\${company}\${prodname}"
!define uninstaller "uninstall.exe"
 
;--------------------------------
 
XPStyle on
ShowInstDetails hide
ShowUninstDetails hide
 
Name "${prodname}"
Caption "${prodname}"
 
!ifdef icon
Icon "${icon}"
!endif
 
OutFile "${setup}"
 
SetDateSave on
SetDatablockOptimize on
CRCCheck on
SilentInstall normal
 
InstallDir "$PROGRAMFILES\${company}\${prodname}"
InstallDirRegKey HKLM "${regkey}" ""
 
;!ifdef licensefile
;LicenseText "License"
;LicenseData "${srcdir}\${licensefile}"
;!endif
 
; pages
; we keep it simple - leave out selectable installation types
 
;!ifdef licensefile
;Page license
;!endif
 
; Page components
Page directory
Page instfiles
 
UninstPage uninstConfirm
UninstPage instfiles
 
;--------------------------------
 
AutoCloseWindow false
ShowInstDetails show
 
 
!ifdef screenimage
 
; set up background image
; uses BgImage plugin
 
Function .onGUIInit
    ; extract background BMP into temp plugin directory
    InitPluginsDir
    File /oname=$PLUGINSDIR\1.bmp "${screenimage}"
 
    BgImage::SetBg /NOUNLOAD /FILLSCREEN $PLUGINSDIR\1.bmp
    BgImage::Redraw /NOUNLOAD
FunctionEnd
 
Function .onGUIEnd
    ; Destroy must not have /NOUNLOAD so NSIS will be able to unload and delete BgImage before it exits
    BgImage::Destroy
FunctionEnd
 
!endif
 
; beginning (invisible) section
Section
 
  WriteRegStr HKLM "${regkey}" "Install_Dir" "$INSTDIR"
  ; write uninstall strings
  WriteRegStr HKLM "${uninstkey}" "DisplayName" "${prodname} (remove only)"
  WriteRegStr HKLM "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"'
 
!ifdef filetype
  WriteRegStr HKCR "${filetype}" "" "${prodname}"
!endif
 
  WriteRegStr HKCR "${prodname}\Shell\open\command\" "" '"$INSTDIR\${exec} "%1"'
 
!ifdef icon
  WriteRegStr HKCR "${prodname}\DefaultIcon" "" "$INSTDIR\${icon}"
!endif
 
  SetOutPath $INSTDIR
 
 
; package all files, recursively, preserving attributes
; assume files are in the correct places
File /r "${srcdir}\*"
File /a "${srcdir}\${exec}"

 
;!ifdef icon
;File /a "${srcdir}\${icon}"
;!endif

 
  WriteUninstaller "${uninstaller}"
 
SectionEnd
 
; create shortcuts
Section
 
  CreateDirectory "${startmenu}"
  SetOutPath $INSTDIR ; for working directory
!ifdef icon
  CreateShortCut "${startmenu}\${prodname}.lnk" "$INSTDIR\${exec}" "" "$INSTDIR\${icon}"
!else
  CreateShortCut "${startmenu}\${prodname}.lnk" "$INSTDIR\${exec}"
!endif
 
SectionEnd
 
; Uninstaller
; All section names prefixed by "Un" will be in the uninstaller
 
UninstallText "This will uninstall ${prodname}."
 
!ifdef icon
UninstallIcon "${icon}"
!endif
 
Section "Uninstall"
 
  DeleteRegKey HKLM "${uninstkey}"
  DeleteRegKey HKLM "${regkey}"
 
  Delete "${startmenu}\*.*"
  Delete "${startmenu}"

  RMDir /r "$INSTDIR"
 
SectionEnd