Get directory of installed .NET runtime: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
 
Line 1: Line 1:
== Description ==
== Description ==
 
Given a .NET version number, this function returns that .NET framework's install directory. This is useful if you intend to call 'RegAsm.exe', or 'GACUtil.exe' on one of your .Net assembly DLLs, since these executables are stored in the directory this function returns.


== Parameters ==
== Parameters ==

Revision as of 00:05, 4 March 2006

Description

Given a .NET version number, this function returns that .NET framework's install directory. This is useful if you intend to call 'RegAsm.exe', or 'GACUtil.exe' on one of your .Net assembly DLLs, since these executables are stored in the directory this function returns.

Parameters

in: version of .Net framework required (eg. "v2.0") out: directory in which it is installed (eg. "C:\WINNT\Microsoft.NET\Framework\v2.0.50727")

Returns "" if the specified version of the .Net framework does not appear to be installed.


Usage

Section "Install"

; get directory of .NET framework installation Push "v2.0" Call GetDotNetDir Pop $R0 ; .net framework installation directory StrCmpS "" $R0 err_dot_net_not_found

; Perform our install SetOutPath $INSTDIR File "MyDll.dll" ExecWait '"$R0\RegAsm.exe" /tlb /codebase /nologo HabitatCaptureDll.dll'

Return

err_dot_net_not_found:

MessageBox MB_OK|MB_ICONEXCLAMATION|MB_DEFBUTTON1 \ "Can't find the required version of the .Net framework." Abort "Aborted: .Net framework not found."

SectionEnd


Function