Talk:Get .NET Version: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
 
(another astebner link)
 
(6 intermediate revisions by 5 users not shown)
Line 6: Line 6:
This is my solution for this problem:
This is my solution for this problem:


Function CheckDotNet
  Function CheckDotNet
  StrCpy $0 ''
      StrCpy $0 ''
  ClearErrors
      ClearErrors
  ReadRegStr $R0 HKLM 'SOFTWARE\Microsoft\ASP.NET\1.1.4322.0' 'Path'
      ReadRegStr $R0 HKLM 'SOFTWARE\Microsoft\ASP.NET\1.1.4322.0' 'Path'
  IfErrors 0 +2
      IfErrors 0 +2
      StrCpy $0 'not found'
        StrCpy $0 'not found'
  Push $0
      Push $0
  Exch $0
      Exch $0
FunctionEnd
  FunctionEnd


/T
:[http://msdn.microsoft.com/library/en-us/cpgenref/html/grfungetcorversion.asp GetCORVersion] is a defined API function provided by the .NET framework. There's no reason it'll not work with .NET 2.0. <s>Reading from the registry is the undocumented method</s> and your specific method relies on a very specific .NET version. --[[User:Kichik|kichik]] 06:43, 19 July 2006 (PDT)


/T
::Just updating info here.  The registry method appears to be the now approved way to detect for specific versions of the framework.  I took the liberty of striking out the outdated info, I hope that's not offensive.  Anyway, the link to MS: http://msdn.microsoft.com/en-us/library/aa480198.aspx#netfx30_topic14 --[[User:Parallaxtz|Parallaxtz]] 06:18, 2 October 2008 (UTC)
 
----
 
I came across some info/code to detect v3 (Not sure how much has changed) and SP levels of .net, might be helpful
 
http://blogs.msdn.com/astebner/archive/2007/03/20/updated-sample-code-to-detect-the-net-framework-3-0.aspx and http://blogs.msdn.com/astebner/pages/9763379.aspx
--[[User:Anders|Anders]] 20:42, 19 April 2010 (UTC)
----
 
I think the issue here is in such a scenario:
 
The user has .NET framework 2.0 installed, but not .NET framework 1.1. But your program needs .NET framework 1.1. (Yes, I have seen computers installed like that)
 
The method would thus allow the program to be installed (as .NET framework 2.0 is detected), but yet it cannot be run (as your program needs framework 1.1).
 
i.e. each .NET framework version can only run programs built for that version (with some exceptions like services packs which are compatible with the no SP versions)

Latest revision as of 20:42, 19 April 2010

I would say that this isn't the optimal way to do it. Since V2.0 isn't always backwards compatible with V1.1.

I now made an installer for an ASP .NET V1.1 solution. And I needed to be sure that V1.1 was installed. This is my solution for this problem:

  Function CheckDotNet
     StrCpy $0 
     ClearErrors
     ReadRegStr $R0 HKLM 'SOFTWARE\Microsoft\ASP.NET\1.1.4322.0' 'Path'
     IfErrors 0 +2
        StrCpy $0 'not found'
     Push $0
     Exch $0
  FunctionEnd

/T

GetCORVersion is a defined API function provided by the .NET framework. There's no reason it'll not work with .NET 2.0. Reading from the registry is the undocumented method and your specific method relies on a very specific .NET version. --kichik 06:43, 19 July 2006 (PDT)
Just updating info here. The registry method appears to be the now approved way to detect for specific versions of the framework. I took the liberty of striking out the outdated info, I hope that's not offensive. Anyway, the link to MS: http://msdn.microsoft.com/en-us/library/aa480198.aspx#netfx30_topic14 --Parallaxtz 06:18, 2 October 2008 (UTC)

I came across some info/code to detect v3 (Not sure how much has changed) and SP levels of .net, might be helpful

http://blogs.msdn.com/astebner/archive/2007/03/20/updated-sample-code-to-detect-the-net-framework-3-0.aspx and http://blogs.msdn.com/astebner/pages/9763379.aspx --Anders 20:42, 19 April 2010 (UTC)


I think the issue here is in such a scenario:

The user has .NET framework 2.0 installed, but not .NET framework 1.1. But your program needs .NET framework 1.1. (Yes, I have seen computers installed like that)

The method would thus allow the program to be installed (as .NET framework 2.0 is detected), but yet it cannot be run (as your program needs framework 1.1).

i.e. each .NET framework version can only run programs built for that version (with some exceptions like services packs which are compatible with the no SP versions)