Disable Feature Using .Net Code - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

renukabitla
Posts: 7
Joined: Mon Oct 17, 2011 2:12 pm

Disable Feature Using .Net Code

Hi

How to set the installation behavior of the features in organization i want to disable it using the .net code
Please please help me in this


Thanks in advance
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Disable Feature Using .Net Code

Hello,

Here's the syntax to help you with this from within a fully fledged C# custom action:

Code: Select all

session.Features["MainFeature"].RequestState = InstallState.<InstallState>;
You can replace <InstallState> with any of the following:

Code: Select all

namespace Microsoft.Deployment.WindowsInstaller
{
// Summary:
// Installed state of a Component or Feature.
public enum InstallState
{
// Summary:
// The component is disabled.
NotUsed = -7,
//
// Summary:
// The installation configuration data is corrupt.
BadConfig = -6,
//
// Summary:
// The installation is suspended or in progress.
Incomplete = -5,
//
// Summary:
// Component is set to run from source, but source is unavailable.
SourceAbsent = -4,
//
// Summary:
// The buffer overflow is returned.
MoreData = -3,
//
// Summary:
// An invalid parameter was passed to the function.
InvalidArgument = -2,
//
// Summary:
// An unrecognized product or feature name was passed to the function.
Unknown = -1,
//
// Summary:
// The component is broken.
Broken = 0,
//
// Summary:
// The feature is advertised.
Advertised = 1,
//
// Summary:
// The component is being removed. In action state and not settable.
Removed = 1,
//
// Summary:
// The component is not installed, or action state is absent but clients remain.
Absent = 2,
//
// Summary:
// The component is installed on the local drive.
Local = 3,
//
// Summary:
// The component will run from the source, CD, or network.
Source = 4,
//
// Summary:
// The component will be installed in the default location: local or source.
Default = 5,
}
}
All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”