c#


Exception while installing VFPOLEDB programmatically


I am trying to install VFPOLEDB driver via a console application.
I tried doing something like this
public void InstallVfpOledb()
{
Type type = Type.GetTypeFromProgID("WindowsInstaller.Installer");
try
{
Installer installer = (Installer)Activator.CreateInstance(type);
installer.InstallProduct(#"C:\VFPOLEDBSetup.msi");
}
catch (Exception e)
{
Console.Write(e.ToString());
}
}
So when I run the program I get the following exception:
System.Runtime.InteropServices.COMException (0x80004005):
InstallProduct,PackagePath,PropertyValues at
System.RuntimeType.ForwardCallToInvokeMember(String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData) at WindowsInstaller.Installer.InstallProduct(String
PackagePath, String PropertyValues) at
installtest.Program.Main(String[] args) line 22
I believe InstallProduct method has path and property values as parameters.
I am missing those values I guess.
Can anyone point me in the correct direction for the same?

This one works for me:
// using Microsoft.Deployment.WindowsInstaller in
// Microsoft.Deployment.WindowsInstaller.dll
try
{
Installer.InstallProduct(#"C:\VFPOLEDBSetup.msi","");
}
catch (Exception e)
{
Console.Write(e.Message);
}
It asks for permission if not run as administrator.


Related Links

Getting files recursively: skip files/directories that cannot be read?
HttpWebRequests blocking UI thread from another thread
Entity Framework and database column names
Will TumblingWindow fire when there is no event?
How to convert type 'system.windows.media.imagesource' to 'system.drawing.image' or byte[] in C#?
Getting integer from textbox
Add Database Field from Mysql Stored Procedure in Crystal Reports
C# Assigning values from List<string> to a string variable
Show toolbar via ToolStripDropDownButton.DropDownItems?
How to log executed sql statement [duplicate]
How can i check if a text file contain more then one line of text inside?
Binding toggle button to two commands
Why does this code for dealing with timestamps use signed integer?
Combining elements in the same list
SetCreationTime not working on files in a Shared Folder
ASP.NET C# Entity Framework - How to update Foreign Key properly?

Categories

HOME
algolia
optimization
azure-documentdb
domain-driven-design
cxf
ldap
postsharp
terminal
css-selectors
open-search-server
revit-api
annyang
dcos
runtime
oms
aws-sdk-cpp
dynamics-crm-2011
websharper
opengrok
dat.gui
filehelpers
datasource
ng-tags-input
oracle-golden-gate
functional-dependencies
android-wear-2.0
sasl
smart-device
gulp-jshint
ocl
semantic-ui-react
concrete5
ios-autolayout
voyager
ragel
multi-user
dotnetnuke-module
stencyl
iterm2
nsdateformatter
mybatis-generator
sknode
pyexcel
chrome-custom-tabs
automapper-4
pyopenssl
history
cloudconvert
cancan
playframework-2.3
senti-wordnet
wicketstuff
pyautogui
alfred
joystick
nsoperationqueue
oryx
wonderware
event-tracking
sdkman
serial-communication
jeet-grid
asp.net-2.0
esri-arc-engine
crtdbg.h
aiff
selenium-grid2
new-operator
complete
mobile-robots
aspnet-compiler
octokit
infomaker
nokogiri
oc4j
maven-webstart-plugin
mosix
infinity.js
coinbase-php
codeigniter-form-helper
pymel
string-length
idoc
cryptarithmetic-puzzle
freeimage
doxia
shapado
php-gettext
github-archive
file-processing
youtube.net-api
ihtmldocument2
moores-law





Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm