Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How can I check for prerequisites and install them without actually installing my application?

Posted on 2011-04-29
16
Medium Priority
?
1,169 Views
Last Modified: 2012-06-27
Hi,

I need some help to understand how I can check for prerequisites, specifically .NET Framework, and install them without actually installing my application but only running it. At the present I am taking the EXE from the debug\bin folder. I know I could add a setup project to my application but it also wants to actually install it into the Program Files folder and places it in the Add/Remove Programs.

My application is not a program that will be run over and over by the user. It has another program and a service embedded within the EXE that it needs to install for the user and then the user can delete my EXE.

The ClickOnce feature in the Setup project is great except it then wants to go on and install my windows application as a program as mentioned above and this is what I would like to avoid so the user' Program Files folder is not cluttered by the unnecessary program.

Thanks in advance for you help!
0
Comment
Question by:camoh
  • 6
  • 5
  • 3
  • +1
16 Comments
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 600 total points
ID: 35491455
If your EXE is built using .NET itself, obviously it can not run if there is not .NET. You would need a bootstrapper. See if this helps

http://www.codeproject.com/KB/mcpp/dotnetsetup.aspx
0
 
LVL 3

Assisted Solution

by:cyborgrd
cyborgrd earned 600 total points
ID: 35491488
you can as example create a dummy msi  with the launch conditions for .Net and custom action for installig it from external location or nested if not installed. And don't publish the msi information for the dummi itself. (just comment or delete the publish action). the dummy will be not registred in the ADD/REMOVEinstalls none of files and regkey itself. It will only install the .Net if not installed.
0
 
LVL 17

Expert Comment

by:nepaluz
ID: 35492610
to check for the .NET framework, you have to look at the registry for a key that indicates whether / what framework is installed.

the key to the hive for 3.5 is
HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v3.5

and 4.0 Client
HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v4\Client

4.0 Full
HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v4\Full

etc

If the vaue is set (and these are set by the .NET installation, not you) then the framework is installed. You could then prompt the user to check install the requisite framework if not on the system.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:camoh
ID: 35492628
CodeCruser,

That project seems a bit old. Visual Studio 2005 complained about parts of it possibly being outdated or unsafe and I am not familiar with the code language that it is written in. So for me to change it to upgrade it could make it "buggy". I am much more familiar with vb.net and VBA.

Another thing I don't really like about that solution is that I would need to compile the dotnetfx.exe in the bootstrapper (if I understand it correctly). This makes the files quite large. I would rather reference it to Microsoft to download the version that is missing like you can do with the Setup template that comes with VS 2005.

cvborqrd,

Can you explain this 'custom action for installig it from external location or nested if not installed' a little more or give an example? I have never worked with a custom action.

Thanks for you input.
0
 
LVL 3

Expert Comment

by:cyborgrd
ID: 35492877
i don't know how you can do it with you msi editing tool. With Wise Package Studio i can include prerequisites from the GUI. It will be downloaded and added to my msi project. See my screenshot. I'll try later to do a dummy msi for you
prereq.jpg
0
 
LVL 3

Expert Comment

by:cyborgrd
ID: 35493441
i've created a dummy msi. It shows only the progress bar (can be disabled) That msi  checks the reg key whether .Net 3.5 is installed (from nepaluz topic). If not it will be downloaded and installed silently (async. no wait, the dummy msi will be closed and not registred in the appwiz) if Net 3.5 is installed nothing will happen(only the progress bar runs).

https://rapidshare.com/files/459805825/dummy_with_installing_net35_fom_internet.msi

i hope i could help you
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35493876
But VB.NET would be no use if there is no .NET framework so you need a bootstraper which runs without the .NET and checks if it exists.
0
 

Author Comment

by:camoh
ID: 35493924
I'm testing, researching, testing, and researching more...

I will keep watching posts along with doing my own testing and let you know when I find a solution.

Thank you very much for your input so far!
0
 

Author Comment

by:camoh
ID: 35504935
I agree, CodeCruiser, that I need a bootstraper. VS 2005 comes with one and I would like to use that one instead of needing to buy another commercial one.

cyborgrd, I tried your msi and it works but how can I make the built-in bootstraper that comes with VS 2005 work as you demonstrate in your msi? I do not have Wise Package Studio.
0
 
LVL 3

Expert Comment

by:cyborgrd
ID: 35506440
what you need as prerequisite? You can run every exe from MSI as Custom Action exepts the exe's what running an MSI. In this case you must unpack the MSI from the EXE and run it as nested MSI.

Following example i've package "A" it needs, VC Redist 2008, Java Runtime 6.x, and HASP Driver.

VC Resit. and Java are MSI. I built it in my msi as nested MSI, the HASP is a EXE Installer and can be installed unattend with parameter /s. I create a Custom action that runs the HASPDRV.EXE /S  and installs it so. I can abort my installation if fails (by Return Codes checking)

At least i've only my  MSI "A" with all prerequisites inside as custom actions.
P.S.
i don't like wrappers.
0
 

Author Comment

by:camoh
ID: 35506871
I specifically need .NET Framework as a prerequisite (as I mentioned in my first post) and I can very easily do a check upon installation if I use the built-in setup1 template that comes with VS 2005. But I never want to install my application. My application has another Program (EXE) embedded within it. When I run my Application it needs to extract the embedded files to their proper place and run the embedded EXE on the fly. The embedded EXE goes through the install process and then hands things back  over to my application for configuration and clean up.

I am sorry but I am not very familiar with coding outside of vb.net and VBA (and even that is very limited compared to what you all know I'm sure).

When you talk about nesting are you referring to embedding a file an embedded resource? Do you have an example of some source code or a source application that I could look at that would help me understand how you are doing this?
0
 
LVL 17

Accepted Solution

by:
nepaluz earned 800 total points
ID: 35507139
You have confused matters to fault!

1. Your program PROGRAM1 (the one that installs another program PROGRAM2) ALSO NEEDS the .NET framework (if it is built using VS). Therefore, your best option would be to ensure that PROGRAM1's prerequisites are extremely minimal (.NET 2.0 springs to mind) in order for it to run at all.

2. You can then use PROGRAM1 to check for PROGRAM2's prerequisites (say .NET 4.0) by looking for the registry key that indicates whether .NET 4.0 is installed.

3. I am not sure whether you can run a console application without .NET, but if you can, then that would be the best option for your PROGRAM1 (that is assuming you do NOT want to use the bundled Installer in VS).

4. Your other option would be to use a third party installer, I use NSIS which is a free opensource installer. I use VB Express and do not like the bloatiness of the clickonce it offers thus I copy my EXE (and any dll's I have included) and use NSIS to handle the setup on client machines. I've had to learn some scripting on the way in order to write scripts to check for prerequisites, but like I mentioned, it is opensource and has good documentation and a vast number of users.
0
 
LVL 3

Expert Comment

by:cyborgrd
ID: 35507153
Yes nested is embedded. I cannot teach you here in the MSI technology it is a biger issue.
If you want a msi i can do it for you but not for free. Another suggestuion you create a batch script with checking the registry key,

reg query RootKeyName\Path\To\Key\To\Query /v KeyName || echo Does not Exist!!!!

if not present install the .Net. unattend

dotnetfx35.exe /q /norestart

then whatever you want.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35508541
0
 

Author Comment

by:camoh
ID: 35511463
I need a little time to check these things out... Thank you all for you input!
0
 

Author Closing Comment

by:camoh
ID: 35747346
I am still not quite done with this but I want to close this.

I am trying out NSIS and it seems to be a good option but haven't worked out all the details.

Thank you again for your input!
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question