check if framework is installed bat file and boot strap question

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
GREGoryAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

iboutchkineCommented:
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
GREGoryAuthor Commented:
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
iboutchkineCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

GREGoryAuthor Commented:
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
manialokCommented:
0
Bob LearnedCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

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.