Old 12th May 2004, 14:39   #1
Latem
Junior Member
 
Join Date: May 2004
Location: Canada
Posts: 6
Installing .NET with dotnetfx.exe

Hello all,

I just got NSIS, so I am very much a newbie. I used HM NIS Editor and its Wizard to make a simple install for an application I am working on. The application is written in VB.NET, and my boss would like me to distribute the framework, and install it if needed, with the installer for the application. I have a few questions regarding this issue.

I found the nifty little function to detect .NET framework in the Documentation (and in the archives), and I got it to work with my script. I also read in the forums that you should place this in the on.Init function, or something like that. I didnt fully understand that. Right now this is what I do:

PHP Code:
Section "GLS" SEC01
  Call IsDotNETInstalled
     Pop $R3
  StrCmp $R3 0 
+3
    
Goto +2
    
; else
    
MessageBox MB_OK "Can't find .NET!"
    
... 
And as you can see this code is at the start of my main "section". My first question is if putting that in onInit is more correct how do I do that? Do I go Function SEC01.onInit or something like that, and place the code there. And then where/how do I call the function?

My second question is how do I get the installer to install the .NET Framework. So, how do I package dotnetfx.exe into my installer, and then how do I get it to run that file (instead of the MessageBox part). I couldn't find an example of this anywhere.

I am kinda under time pressure, so I havent looked at the docs in great detail, so Im not familiar with much yet. That's also why I am asking for help. Sorry if this is supposed to be "common" knowledge or something, and I am asking how to do it.

Aside, from my little experince with NSIS, it seems like its a pretty cool system. And definitly different from MS Visual Studio Installer tool.

Thanks in advance,

Latem
Latem is offline   Reply With Quote
Old 13th May 2004, 09:09   #2
Davion
Senior Member
 
Join Date: Apr 2004
Location: Nuremberg, Germany
Posts: 130
Send a message via Yahoo to Davion
Welcome to the forums Latem

onInit isn't a section, it's a function which is called right after starting the exe so you should define your onInit function like below on the very first beginning of your script

code:

Function .onInit
Call IsDotNETInstalled
Pop $R3
StrCmp $R3 0 +3
Goto +2
; else
MessageBox MB_OK "Can't find .NET!"
...
FunctionEnd





to install .NET framework you should use ExecWait, cause it waits until the called application finished, alternative you can call it after your last dialog to install if necessary

ExecWait:
ExecWait '"C:\path\framework.exe" (/parameters)'
first you write the path of the file you wanna use,
and after this you set parameters you maybe need

(You can find more Examples in NSIS\Examples\ as the name says)

hope this helps

greets Davion
Davion is offline   Reply With Quote
Old 13th May 2004, 12:44   #3
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
Just a side note:

You should also be careful to install the .NET Framework that matches the INSTALLED locale version of the Operating System. You should obtain the framework from the appropriate link. I have listed a few of these below. If you do not adhere to this, you could make your clients system unstable.

; .NET Framework
;English
!define URL_DOTNET_1033 "http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe"
;German
!define URL_DOTNET_1031 "http://download.microsoft.com/download/4/f/3/4f3ac857-e063-45d0-9835-83894f20e808/dotnetfx.exe"
;Spanish
!define URL_DOTNET_1034 "http://download.microsoft.com/download/8/f/0/8f023ff4-2dc1-4f10-9618-333f5b9f8040/dotnetfx.exe"
;French
!define URL_DOTNET_1036 "http://download.microsoft.com/download/e/d/a/eda9d4ea-8ec9-4431-8efa-75391fb91421/dotnetfx.exe"
;Portuguese (Brazil)
!define URL_DOTNET_1046 "http://download.microsoft.com/download/8/c/f/8cf55d0c-235e-4062-933c-64ffdf7e7043/dotnetfx.exe"
;Chinese (Simplified)
!define URL_DOTNET_2052 "http://download.microsoft.com/download/7/b/9/7b90644d-1af0-42b9-b76d-a2770319a568/dotnetfx.exe"

See the Microsoft Download page for the framework, select the disered language and view the source and scan it for the download link if you need a language that I have not provided above.

Cheers,

ZIMSMS
zimsms is offline   Reply With Quote
Old 14th May 2004, 12:42   #4
Latem
Junior Member
 
Join Date: May 2004
Location: Canada
Posts: 6
Thanks for the feedback.

This is my .onInit function:
PHP Code:
Function .onInit
  
check for .NET
  Call IsDotNETInstalled
    Pop $R3
    StrCmp $R3 0 not_found found
    found
:
        goto 
end
    not_found
:
        
MessageBox MB_OKCANCEL "GLS has detected that you do not have Microsoft .NET Framework Installed.\r\n Press OK to install .NET Framework."
        
pop $R0
        StrCmp $R0 IDOK installNET
        Abort
        installNET
:
            
SetOutPath "$INSTDIR"
            
SetOverwrite ifnewer
            File 
"dotnetfx.exe"
            
ExecWait '"$INSTDIR\dotnetfx.exe"'
    
end:
FunctionEnd 
When I run my installer on a computer w/o .NET, it detects that it's not there properly. Then the msg box comes up, but when I press "OK" nothing seems to happen. It did not start the .NET install. What am I doing wrong?

thanks,

Latem
Latem is offline   Reply With Quote
Old 14th May 2004, 13:23   #5
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
Try the following:

PHP Code:
Function .onInit 
  
check for .NET 
  Call IsDotNETInstalled 
    Pop $R3 
    StrCmp $R3 0 not_found found 
    found

        goto 
end 
    not_found

        
MessageBox MB_OKCANCEL "GLS has detected that you do not have Microsoft .NET Framework Installed.\r\n Press OK to install .NET Framework." IDOK installNET IDCANCEL 0
        Abort 
        installNET

            
SetOutPath "$INSTDIR
            
SetOverwrite ifnewer 
            File 
"dotnetfx.exe" 
            
ExecWait '"$INSTDIRdotnetfx.exe"' 
    
end
FunctionEnd 
zimsms is offline   Reply With Quote
Old 14th May 2004, 14:25   #6
Latem
Junior Member
 
Join Date: May 2004
Location: Canada
Posts: 6
that worked.

thank you.

Latem
Latem is offline   Reply With Quote
Old 14th May 2004, 14:44   #7
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
I have contributed an example of installing the .Net Framework, feel free to take a look at it at the following location.


Installing the Microsoft .Net Framework (Multi Language Example)
zimsms is offline   Reply With Quote
Old 28th May 2004, 04:01   #8
mattdisaster
Junior Member
 
Join Date: May 2004
Location: branford, ct
Posts: 10
Send a message via AIM to mattdisaster
I don't mean to steal your thread, or be a complete noob - but I have been fooling around with the same thing and haven't been able to get it working. For some reason or another nothing happens once the script gets compiled, it just doesnt execute, any ideas? Thanks in advance.

-matt
Attached Files
File Type: nsi working.nsi (35.6 KB, 1021 views)
mattdisaster is offline   Reply With Quote
Old 28th May 2004, 12:39   #9
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
Matt,

I have attached a modified version of your script that will give you the functionality you asked for, However, I strongly advise that you read my Archive document (Follow the link above), to see how this should be done properly in a multi lingual install.


BTW: You had it in an endless loop, and were never actually checking the registry to see if .Net was installed.

Cheers,

ZIMSMS
Attached Files
File Type: nsi fixed.nsi (36.5 KB, 1154 views)
zimsms is offline   Reply With Quote
Old 28th May 2004, 12:47   #10
mattdisaster
Junior Member
 
Join Date: May 2004
Location: branford, ct
Posts: 10
Send a message via AIM to mattdisaster
Thanks alot! I was actually trying to edit or remove my post when you were posting your reply! I'll blame that one on me being just completely out of whack. I restarted/organized my script and I'm gonna take it one step at a time. I'm now looking more indepth to your documentation and getting overwhelmed already, but I will endure. heh Thanks again for the help!

-matt
mattdisaster is offline   Reply With Quote
Old 28th May 2004, 13:05   #11
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
If you need help, let me know. I made a really nice Multilingual Example, but unfortunately, I set it up with a real world build environment set up for locale branding and everything, very flexible. Unfortunately, doing all that made it a little bit too big to post on the archive or in a thread.
zimsms is offline   Reply With Quote
Old 28th May 2004, 13:51   #12
mattdisaster
Junior Member
 
Join Date: May 2004
Location: branford, ct
Posts: 10
Send a message via AIM to mattdisaster
Alittle help would be great! If you want to send it to me, that would be fine, mattnorman82@snet.net shoudl be able to take it, just something to give me a heads up on how it should be set up, I've come to terms with me being a total newb. lol. Thanks again for everything!

-matt

ps- I'm also idling in the chat room under the handle Disaster
mattdisaster is offline   Reply With Quote
Old 15th November 2005, 14:01   #13
Fretje
Guest
 
Posts: n/a
How to obtain right language

I think I'm not getting this right...
The dotnetfx.exe you install has to be the same language as the os you are installing it on right?
But like I interpret your code, you let the user select a language... What if that isn't the right one?
Isn't there a way to determine the OS language and not let the user select it?

TIA,

Fretje
  Reply With Quote
Old 15th November 2005, 22:28   #14
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
Hello Fretje,

Actually, It does interpret the OS you are running on, and installs the appropriate dotnet executable no matter what language you choose to install the application in.

Cheers,

zimsms
zimsms is offline   Reply With Quote
Old 15th November 2005, 22:47   #15
JCD29
Junior Member
 
Join Date: Sep 2003
Location: FRANCE
Posts: 34
Just to know how to get if the .net dotnetfx.exe has already been installed.
To test if the registry key exists : Software\Microsoft\.NETFramework

thanks by advance.

JCD
JCD29 is offline   Reply With Quote
Old 16th November 2005, 07:03   #16
Fretje
Guest
 
Posts: n/a
Hello zimsms,

Can you please shed some light on this please, because I realy don't see it.
What I see in your .OnInit function is the following line:

StrCpy $URL_DOTNET "${URL_DOTNET_1033}"

But that's the only place where $URL_DOTNET is assigned and this looks quite "hard coded" to me...
Or am I missing something?
Where is the logic which determines the os language, and assigns the $URL_DOTNET accordingly?

Greetings,

Fretje
  Reply With Quote
Old 16th November 2005, 15:16   #17
Fretje
Guest
 
Posts: n/a
Other people than zimsms may answer as well ;-)
Or am I not the only one who isn't seeing it?

Greetz,

Fretje
  Reply With Quote
Old 17th November 2005, 09:51   #18
JCD29
Junior Member
 
Join Date: Sep 2003
Location: FRANCE
Posts: 34
Just to know how to get if the .net dotnetfx.exe has already been installed.
To test if the registry key exists : Software\Microsoft\.NETFramework

thanks by advance.

JCD
JCD29 is offline   Reply With Quote
Old 17th November 2005, 16:52   #19
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
Fretje,

There used to be a complete example in the archive, but they've changed so much on this site, that I can't find it. I went and looked at my post, the one you are asking about. It looks like a piece of it may be missing. I noticed some of my files had been altered as well.

I currently don't have the code on this machine. But, I can tell you the code you are looking for was in an override of the .GUIInit function, which I had called MyGUIINit. Basically you check in this override for the variable you populated in the .oninit ($OSLANGUAGE) then StrCpy the appropriate URL into the URL_DOTNET variable. The initial assignment you are seeing is just a default initialization.

I will see if I can find a copy of my old example, and post the block in the thread. Finding it, may take a while, and I won't be able to post it until 8pm EST. (Currently (1pm EST).

Cheers,

ZIMSMS
zimsms is offline   Reply With Quote
Old 17th November 2005, 16:54   #20
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
JCD29,

Check out the Get .Net Version function.

Cheers,

ZIMSMS
zimsms is offline   Reply With Quote
Old 18th November 2005, 08:46   #21
Fretje
Junior Member
 
Join Date: Nov 2005
Posts: 13
hello zimsms,

I'm looking forward to receiving the right code...

Thanks a lot already!

Fretje
Fretje is offline   Reply With Quote
Old 20th November 2005, 17:50   #22
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Quote:
Originally posted by zimsms
There used to be a complete example in the archive, but they've changed so much on this site, that I can't find it.
All of the old Archive links should still work. If they don't, please let me know.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 21st November 2005, 21:32   #23
JCD29
Junior Member
 
Join Date: Sep 2003
Location: FRANCE
Posts: 34
thanks zimsms

for your help.. i discover the link

JCD
JCD29 is offline   Reply With Quote
Old 22nd November 2005, 06:49   #24
Fretje
Junior Member
 
Join Date: Nov 2005
Posts: 13
Still waiting for the code...
or some more insight into retrieving the OS language...

tnx,

Fretje
Fretje is offline   Reply With Quote
Old 22nd November 2005, 22:57   #25
zimsms
Senior Member
 
zimsms's Avatar
 
Join Date: Jan 2004
Location: London, Ontario, Canada
Posts: 272
Fretje,

I sent you a private message a few days ago.....

Cheers,

ZIMSMS
zimsms is offline   Reply With Quote
Old 23rd November 2005, 11:34   #26
Fretje
Junior Member
 
Join Date: Nov 2005
Posts: 13
Zimsms,

I didn't even know I could receive private messages ;-)
But I have seen it now and replied to it...

Greetings,

Fretje
Fretje is offline   Reply With Quote
Old 31st January 2006, 16:42   #27
JCD29
Junior Member
 
Join Date: Sep 2003
Location: FRANCE
Posts: 34
where is described IsDotNETInstalled ?
this method is provided with NSIS examples ?

JCD
JCD29 is offline   Reply With Quote
Old 31st January 2006, 17:46   #28
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You can use this one:

http://nsis.sourceforge.net/Get_.NET_Version

Or the original IsDotNETInstalled:

http://nsis.sourceforge.net/Special:...otNETInstalled

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump