473,378 Members | 1,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Custom Actions using C# from WIX

Hi,

I am trying to pass parameters from WIX to C# code, but I am not able to do it properly. To code that I have written on WIX side is:
<Property Id="teststring">
<![CDATA[Hello world]]>
</Property>
<CustomAction Id="testing" Return="check" BinaryKey="test" DllEntry="hello"/>
<Binary Id="test" src="test.dll" />
<CustomAction Id="testing.setproperty" Return="check" Property="testing" Value="[teststring]" />

<InstallExecuteSequence>
<Custom Action="testing.setproperty" After="InstallFiles" />
<Custom Action="testing" After="testing.setproperty" />
</InstallExecuteSequence>

The code I have written in C# and compiled as a DLL is :

using System;
using System.Text;
using System.Runtime.InteropServices;

namespace testing
{
public class test{
public static int hello(IntPtr handle)
{
int i;
int ptrcnt = 256;
//System.Windows.Forms.MessageBox.Show( String.Format( "Hello World {0}",handle) );
StringBuilder sb = new StringBuilder(ptrcnt);
i = MsiGetProperty(handle,"CustomActionData",sb,ref ptrcnt);
System.Windows.Forms.MessageBox.Show( String.Format( "{0}",sb ) ;

return 0;
}
[DllImport("msi.dll", CharSet=CharSet.Unicode)]
static extern int MsiGetProperty(IntPtr hInstall, string szName, [Out] StringBuilder szValueBuf, ref int pchValueBuf);


}
}

But I am not able to pass the property value to C#. Can anyone please let me know if I am missing anything.

Thank you,
regards
balaji.
Aug 1 '07 #1
0 1725

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Angela | last post by:
I wrote a class that I intended to be a custom action. I added the DLL for the class to the setup project using the CustomActions editor. When I run the installer it completely ignores the custom...
3
by: Vai2000 | last post by:
Hi All, I need to execute custom action during installation of my program (through MSI). Creating the MSI was pretty straight fwd. After that I went into the Custom Action Editor and added the...
0
by: Ron Andersen | last post by:
I have C# custom actions and merge modules created in Visual Studio to install some components of the application I am working on. The merge modules are used with an Install Shield 9 project. ...
0
by: Larry | last post by:
I need to create a custom action application on install. does anyone have any experience on how to configure an application to run on install when creating the 'setup program'? 1.what are the...
0
by: Gabriel Lozano-Morán | last post by:
We have developed an application that will replace the older version. The older versions comes in two flavors, a Lite and a Pro version. I can successfully remove the previous version of either the...
1
by: lyl209 | last post by:
Hi, I am trying to create a web setup project for my asp.net 2.0 website and I had some problems. It worked fine until I want to add some custom actions into it. As some of you already knew,...
1
by: Gene | last post by:
I would like to know if the following is even possible with the visual studio.net Setup and Deployment project. 1. During the deployment after creation of application directory the setup needs...
10
by: =?Utf-8?B?SmFjayBTbWl0aA==?= | last post by:
Hello, I have a solution that contains a C# application that is installed and runs as a service. The solution also contains several DLLs, some of which are C# assemblies and some are C++ DLLs. ...
13
by: Matt F | last post by:
I have a deployment project that I'm setting up. I need to perform a different custom action based on whether this is a first time install or an update. Does anyone have any idea if it's possible...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Actually, my installer package is not for a Windows Service, but for a WinForms application. Well, it is kind of both: this is a multi-project solution with its main target being a WinForms...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.