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

x
?
Solved

check if framework is installed bat file and boot strap question

Posted on 2003-03-12
7
Medium Priority
?
622 Views
Last Modified: 2012-08-13
IN Dot_Net/Q_20334511.html  gcottle  wrote:

I have built a deployment project for the application and have made use of the Setup Bootstrapper Proejct which Microsoft provided for loading the Framework on a PC. All works well.



Heres my question
I have a VB.NET Windows Application using MS Access. Created a MSI for it.

Tried to install it on the clients machine.. It installed perfectly.
However while running the application he got a "System.TypeInitializationException" and did not start up.

1. NOW is there a way to bootstrap the setup to check for the version of the Framework or if its present at all and then prompt the user to download it from the web during install ?

2. OR Any other method of determining if the correct frameworkk is installed
and if not gracefully erroring out -> with a custiom error ?

3. Can some one show me how to write a small .BAT file -  the user can run to verify if the framework is installed on the system ?
If yes Display - system components are installed correctly
if NOT then display "some error I will fill out"

TIA

Greg
0
Comment
Question by:GREGory
6 Comments
 
LVL 28

Expert Comment

by:iboutchkine
ID: 8119002
1. Check if such dir exists
%windir%\Microsoft.NET\Framework\

or

You could check the registry. The location
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
contains a registry key for each program installed. This information is
listed in Add/Remove Programs in Control Panel.

The key for Microsoft .NET Framework is:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B433
57AA-3A6D-4D94-B56E-43C44D09E548}


also

You can search for this Registry key.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v1.0 and its
Value key value.

also you can check this
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/dotnetframedepguid.asp
distribute with app
and
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/vsredistdeploy.asp

0
 

Author Comment

by:GREGory
ID: 8119396
iboutchkine thanks for the reply ...

Specifically what would the .bat file be which will check for the version ....

Its got to run without windows scripting host ....

When the user clicks the foo.bat file the file will say "OK- your PC has the 1.0.3275 framework" OR "ERROR- you need to download and install the framework"


Also if possible how can I chain it to the end of the setup.msi creation so when a user installs the .msi file it will execute the bat file and popup the message...(this is better if its there but not critical)

Thanks

Greg

0
 
LVL 28

Accepted Solution

by:
iboutchkine earned 200 total points
ID: 8119621
I would write VB Script that will check the registry. (I prefer to do it with WSH).
If you don't want to use WSH then probably you can read registry with REGEDIT. I did not try it, but I think it will be sommethig like that

1.Create File with extension .reg (for example RG.reg

 Open "c:\temp\RG.reg" For Output As #1
    Print #1, "REGEDIT4"
    Print #1, ""
    Print #1, ' here you can write the code to read reg key.
Close #1
You can play with it. Extract some info from registry and then open the extracted file and see how it is done

2.Execute the RG.reg file


Again I want to mention I would've done it with WSH. Something like
Set Sh = CreateObject("WScript.Shell")
key =  key where .NET Framework supposed to be
WScript.Echo Sh.RegRead(key)
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

Author Comment

by:GREGory
ID: 8120519
1. need a .BAT file type of checking which will run regardless if scripting has been enabled or turned off, WSH is gr8 but does not solve the issue.

2. the version to check is 1.0.3705

 OR

3. If this checking happens during setup from the MSI too its fine,

4. The MSI will fail on its own if the .NET runtime is missing from a PC, but if a prev version is there then it will setup correctly but the application will not start..



thanks once again
0
 
LVL 1

Expert Comment

by:manialok
ID: 8125811
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9671375
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by iboutchkine

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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. …
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…

581 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