?
Solved

check if framework is installed bat file and boot strap question

Posted on 2003-03-12
7
Medium Priority
?
621 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

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

Major Serverless Shift

Comparison of major players like AWS, Microsoft Azure, IBM Bluemix, and Google Cloud Platform

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…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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