2016-04-08 9 views
0

私は既存のアプリケーションを更新していて、新しいアプリケーションバージョン番号を設定したいと思います。 !define VERSION "Version Number"を使用しましたが、アプリケーションは以前のバージョン番号を保持しています。私は解決策を探すのにNSIS SourceForgeも行ってきましたが、バージョン番号を表示して変更することはできませんでした。私はショーにしたいのバージョン番号は、2.1.1259.1ですが、それは次のように古い2.0.236.1258私のNSISインストーラを変更するアプリケーションバージョン

コードが見え返す保持します!私はたくさんのがあります実現

; HM NIS Edit Wizard helper defines 
!define PRODUCT_NAME "Application Name" 
!define PRODUCT_VERSION "2.1.1259.1" 
!define VERSION "2.1.1259.1" 
!define PRODUCT_PUBLISHER "CompanyName" 
!define PRODUCT_WEB_SITE "http://www.CompanyName.com" 
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}" 
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" 
!define PRODUCT_UNINST_ROOT_KEY "HKLM" 


Var InDebugMode 
Var SQLAccountType 
Var SQLUSER 
Var SQLPASSWORD 
Var SQLSERVER 
Var RunInstalls 
Var CurrentStep 
Var InstallDB 
Var SupportedVersions 
Var SetupFileName 
Var InstallsPath 

; MUI 1.67 compatible ------ 
!include "MUI.nsh" 
!include "LogicLib.nsh" 
!include "Source\Scripts\DotNetDetect.nsh" 
!include "Source\Scripts\WriteToFile.nsh" 
!include "Source\Scripts\Page_InstallerPage.nsh" 
!include "Source\Scripts\TrimString.nsh" 


!include WinMessages.nsh 
!include "LogicLib.nsh" 
!include "x64.nsh" 
!include "Source\Scripts\StrRep.nsh" 
!include "Source\Scripts\InstallerControl.nsh" 
!include "Source\Scripts\ReplaceInFile.nsh" 

!include "Source\Scripts\Debug.nsh" 
!include "Source\Scripts\VersionCompare.nsh" 
!include "Source\Scripts\CheckWindows.nsh" 
!include "Source\Scripts\CheckDotNet4.nsh" 
!include "Source\Scripts\CreateShortcuts.nsh" 
!include "Source\Scripts\InstallFonts.nsh" 

; MUI Settings 
!define MUI_ABORTWARNING 
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" 
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" 
!define UMUI_HEADERIMAGE_BMP "ilaundry-logo.bmp" 
!define MUI_BGCOLOR 0xFFFFFF 


!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipOnRestart_Licence 


!insertmacro MUI_PAGE_LICENSE "Source\Scripts\TAC.TXT" 


Page custom Installer_Page_Start Installer_Page_Leave 



!include "Source\Scripts\InstallCrystalReports.nsh" 
!include "Source\Scripts\UpdateConfigFile.nsh" 
!include "Source\Scripts\InstallSqlServer.nsh" 
!include "Source\Scripts\InstallDatabase.nsh" 
!include "Source\Scripts\InstallDigitalPersona.nsh" 
!include "Source\Scripts\InstallAccessDBEngine.nsh" 
!include "Source\Scripts\InstallApplication.nsh" 
!include "Source\Scripts\InstallBackup.nsh" 
!include "Source\Scripts\UninstallSqlServer.nsh" 
!include "Source\Scripts\SplashController.nsh" 


!define MUI_PAGE_CUSTOMFUNCTION_PRE Skip_Finish 
!insertmacro MUI_PAGE_FINISH 

; Uninstaller pages 
!insertmacro MUI_UNPAGE_INSTFILES 

; Language files 
!insertmacro MUI_LANGUAGE "English" 

; MUI end ------ 



Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" 
InstallDir "$PROGRAMFILES\ApplicationName" 
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" 
ShowInstDetails show 
ShowUnInstDetails show 

Function SkipOnRestart_Licence 
     ${IfNot} $CurrentStep == "new" 
       Abort 
     ${EndIf} 
FunctionEnd 

Function Skip_Finish 
     Abort 
FunctionEnd 

Function SharedOnInt 

     InitPluginsDir 
     File /oname=$PLUGINSDIR\InstallScreen.ini "Source\Scripts\InstallScreen.ini" 

     StrCpy $InDebugMode 'True' 
     StrCpy $RunInstalls 'True' 

     strcpy $StepBeforeReboot "none" 

     CALL LoadCurrentStep 

     PUSH 'onInt - Start' 
     PUSH '' 
     CALL DumpValues 

     SetRegView 64 

     DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" 

     SetRegView 32 

     #call uninstallSQLServer 

     writeUninstaller $INSTDIR\uninstaller.exe 

     PUSH 'onInt - End' 
     PUSH '' 
     CALL DumpValues 
FunctionEnd 


Function .onGUIEnd 
     ;Push '$INSTDIR\LogDump.txt' 
     ;Call DumpLog 
FunctionEnd 

Var UnRegValue 

# create a section to define what the uninstaller does. 
# the section will always be named "Uninstall" 
section "Uninstall" 

# Always delete uninstaller first 
delete $INSTDIR\uninstaller.exe 

     ReadRegStr $UnRegValue HKLM "SOFTWARE\${PRODUCT_PUBLISHER}\${PRODUCT_NAME}\${PRODUCT_VERSION}" "InstalledSQL" 
     ${If} $UnRegValue == "true" 
      call un.uninstallSQLServer 
     ${EndIf} 


     ReadRegStr $UnRegValue HKLM "SOFTWARE\${PRODUCT_PUBLISHER}\${PRODUCT_NAME}\${PRODUCT_VERSION}" "InstalledCrystalReports" 
     ${If} $UnRegValue == "true" 
      call un.uninstallSQLServer 
     ${EndIf} 
    ;StrCmp $UnRegValue "true" UninstallSQLServer 

sectionEnd 

が含まれます質問スペースを節約するために私はそれらを残しましたが、その問題がその中に隠れていると思うなら、その特定の.nshファイルを追加します。最終的には、どんな助けもありがとうございます。

+0

アプリケーションバージョン番号は、おそらくインストーラのものではなく、アプリケーションのソースコードのどこかで定義されています。いずれにしても、[VIAddVersionKey](http://nsis.sourceforge.net/Docs/Chapter4.html#versioninfo)機能について読むことができます。 –

+0

VIFileVersion 2.1.1259.1&VIProductVersion 2.1.1259.1を挿入しました。うまくいきましたが、アプリのプロパティをチェックすると、前のプロパティと同じでした。 –

答えて

1

PRODUCT_VERSIONはコンパイラにとって特別な意味を持たない定義に過ぎず、VI *属性はNSISのバージョン情報を設定するために使用されます。

バージョン情報は、binary blockreadable stringsの両方に格納されています。バイナリブロック情報はVIProductVersionVIFileVersion属性で制御され、文字列情報はVIAddVersionKeyで設定されます。これらの属性は、投稿したコードには存在しないため、.nshファイルのいずれかになければなりません。おそらくあなたは複数の場所にそれらを置いていますか?

それは次のようになります。

!define PRODUCT_VERSION "2.1.1259.1" 
!define VERSION "2.1.1259.1" 

VIProductVersion "${PRODUCT_VERSION}" 
VIFileVersion "${VERSION}" 
VIAddVersionKey "FileVersion" "${VERSION}" 
VIAddVersionKey "LegalCopyright" "(C) Blah blah Inc." 
VIAddVersionKey "FileDescription" "Blah blah blergh fancy app" 

をあなたはまだあなたが、おそらくExplorerが情報をキャッシュされた複数の場所で情報を設定していないことを確認した後、間違った値を取得している場合。 Resource Hackerのようなツールを使って生のバージョン情報を調べることができます。

+0

ありがとうございます。他の人のコードを別の.nshファイルで使用しているかどうかチェックしています。それ以外の場合はリソースハッカーを使用します。どうもありがとうございました。 –

関連する問題