【发布时间】:2015-08-07 15:06:13
【问题描述】:
在我的项目中,我有一个 xml 文件,其中存储了程序读取和显示的一堆字符串。我想要发生的是使用该文件构建程序,使用安装脚本创建安装程序(我已经通过构建后事件将所有 .dll 和 .exe 文件移动到脚本的 bin 文件夹)然后拥有最终用户能够访问该文件并让程序在每次运行时自动加载该文件。
这是我目前打开文件的方式。这看起来在调试文件夹中,但我希望它位于持久位置。
XmlDocument doc = new XmlDocument();
doc.Load("PowerManagers.xml");
我的 .nsi 文件:
!define FullName "Power Manager Safety Testing"
!define ProductName "Power Manager Safety Testing"
!define ProductExe "PowerManagerSafetyTesting.exe"
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
!include "Framework .Net Install.nsh"
!include "Common Functions.nsh"
!include "Common Drivers.nsh"
ShowInstDetails show
!insertmacro Insert_System_Configuration
;--------------------------------
; The stuff to install
Section "${ProductName}" Sec_Id_Main
SectionIn RO
Call MainSectionInstall
; The files to use in this installer
File "..\..\bin\PowerManagerSafetyTesting\*.exe"
File "..\..\bin\PowerManagerSafetyTesting\*.dll"
File "..\..\bin\PowerManagerSafetyTesting\PowerManagers.xml"
SectionEnd
;---------
;---------
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts" Sec_Id_Start
Call StartMenuSection
SectionEnd
;---------
; Optional section (can be disabled by the user)
Section "Desktop Shortcuts" Sec_Id_Desktop
Call DesktopShortcutsSection
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
Call un.UninstallerSection
SectionEnd
;--------------------------------
; Page descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SECDOTNET_ID} $(DESC_LONGDOTNET)
!insertmacro MUI_DESCRIPTION_TEXT ${Sec_Id_Main} "Installs the core files required to run the ${ProductName}"
!insertmacro MUI_DESCRIPTION_TEXT ${Sec_Id_Start} "Installs short cuts to the start menu"
!insertmacro MUI_DESCRIPTION_TEXT ${Sec_Id_Desktop} "Installs short cuts to the desktop"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
【问题讨论】: