This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Custom Action from .NET
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 26, 2011
06:59 PM
Custom Action from .NET
Hi Guys,
I'm new to InstallShield, but relatively experienced with .NET. I'm trying to build a custom action from a .NET DLL. Here is the code from my .NET DLL:
[FONT="Courier New"]using System.Linq;
using System.Text;
using System.IO;
using System.Configuration.Install;
using System.ComponentModel;
namespace KnowledgePartners.Trim.Installer
{
}[/FONT]
As you can see its relatively straightforward. However when I add this DLL as a .NET custom action in InstallShield and Debug, I get the message:
Can not find the entry point of function 'KnowledgePartners.Trim.Installer.Cleaner.Install', make sure it is exported.
I'm not exactly sure what I've done wrong.. and I may ofcourse be completely off track. I can't seem to find anything that walks through how to do this, so if anyone knows, or has a link to an explanation it would be greatly appreciated.
Cheers.
I'm new to InstallShield, but relatively experienced with .NET. I'm trying to build a custom action from a .NET DLL. Here is the code from my .NET DLL:
[FONT="Courier New"]using System.Linq;
using System.Text;
using System.IO;
using System.Configuration.Install;
using System.ComponentModel;
namespace KnowledgePartners.Trim.Installer
{
[RunInstaller(true)]
public class Cleaner : System.Configuration.Install.Installer
{
}
public class Cleaner : System.Configuration.Install.Installer
{
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Install(IDictionary stateSaver)
{
}
public override void Install(IDictionary stateSaver)
{
try
{
}
catch (System.Exception ex)
{
}
{
base.Install(stateSaver);
StreamWriter sw = new StreamWriter("C:\\DoesMyCustomActionWork.txt");
sw.WriteLine("yes");
sw.Close();
return;
StreamWriter sw = new StreamWriter("C:\\DoesMyCustomActionWork.txt");
sw.WriteLine("yes");
sw.Close();
return;
}
catch (System.Exception ex)
{
}
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Uninstall(IDictionary savedState)
{
}
public override void Uninstall(IDictionary savedState)
{
try
{
}
catch (System.Exception ex)
{
}
{
base.Uninstall(savedState);
File.Delete("C:\\DoesMyCustomActionWork.txt");
File.Delete("C:\\DoesMyCustomActionWork.txt");
}
catch (System.Exception ex)
{
}
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Commit(IDictionary savedState)
{
}
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Rollback(IDictionary savedState)
{
}
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
}
}
}[/FONT]
As you can see its relatively straightforward. However when I add this DLL as a .NET custom action in InstallShield and Debug, I get the message:
Can not find the entry point of function 'KnowledgePartners.Trim.Installer.Cleaner.Install', make sure it is exported.
I'm not exactly sure what I've done wrong.. and I may ofcourse be completely off track. I can't seem to find anything that walks through how to do this, so if anyone knows, or has a link to an explanation it would be greatly appreciated.
Cheers.
(3) Replies
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 26, 2011
08:30 PM
Please try DotNetCoCreateObject function to load your .Net DLL.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 27, 2011
10:11 AM
I won't add this DLL directly as a custom action.
Instead add it to a component (without using Dynamic Links) and in component's properties select .NET Installer Class to Yes. It will also let you select this assembly under .NET Application File. That should do it.
Also, with Installer Classes my experience is it is difficult to debug the code in case of problems. The easier solution is to add a conditional "debugger launch" so that you can attach your Visual Studio debugger in case you want to debug your code.
[CODE]
public Cleaner ()
{
InitializeComponent();
LaunchDebuggerOnStart();
}
[Conditional("DEBUG")]
private static void LaunchDebuggerOnStart()
{
System.Diagnostics.Debugger.Launch();
}[/CODE]
Instead add it to a component (without using Dynamic Links) and in component's properties select .NET Installer Class to Yes. It will also let you select this assembly under .NET Application File. That should do it.
Also, with Installer Classes my experience is it is difficult to debug the code in case of problems. The easier solution is to add a conditional "debugger launch" so that you can attach your Visual Studio debugger in case you want to debug your code.
[CODE]
public Cleaner ()
{
InitializeComponent();
LaunchDebuggerOnStart();
}
[Conditional("DEBUG")]
private static void LaunchDebuggerOnStart()
{
System.Diagnostics.Debugger.Launch();
}[/CODE]
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 28, 2011
05:08 PM
If you have not, please refer to this thread.