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

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!
camohAsked:
Who is Participating?
 
nepaluzCommented:
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
 
CodeCruiserCommented:
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
 
cyborgrdCommented:
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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
nepaluzCommented:
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
 
camohAuthor Commented:
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
 
cyborgrdCommented:
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
 
cyborgrdCommented:
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
 
CodeCruiserCommented:
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
 
camohAuthor Commented:
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
 
camohAuthor Commented:
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
 
cyborgrdCommented:
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
 
camohAuthor Commented:
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
 
cyborgrdCommented:
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
 
CodeCruiserCommented:
0
 
camohAuthor Commented:
I need a little time to check these things out... Thank you all for you input!
0
 
camohAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.