logo
down
shadow

.Net Windows Services and InstallState file - is it really needed?


.Net Windows Services and InstallState file - is it really needed?

Content Index :

.Net Windows Services and InstallState file - is it really needed?
Tag : .net , By : perl
Date : January 10 2021, 01:47 PM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

.net 2.0 setup project with custom action and InstallState file


Tag : windows , By : Skee
Date : March 29 2020, 07:55 AM
hope this fix your issue I solved the problem my self. The custom action sequence was
1)Custom action dll

WIX and removing .InstallState file


Tag : wix , By : tlync
Date : March 29 2020, 07:55 AM
this will help If this file is installed with your application, it should be removed automatically on uninstall.
If this file is created later, then you should add RemoveFile element with On="uninstall" into a corresponding component.

Exclude .InstallState file from MSI


Tag : chash , By : Mare Astra
Date : March 29 2020, 07:55 AM
hop of those help? I found a workaround for this, During installation i'm doing a File.Delete(). I'm deleteing the file within OnComitting() of installer class.
protected override void OnCommitting(System.Collections.IDictionary savedState)
{
    string installedPath = string.Empty;
    installedPath = Context.Parameters["assemblypath"];
    installedPath = installedPath.Substring(0, installedPath.LastIndexOf('\\'));

    File.Delete(Path.Combine(installedPath, "InstallerHelper.InstallState"));

    base.OnCommitting(savedState);

}

Can we deserialize InstallState file?


Tag : chash , By : Lathentar
Date : March 29 2020, 07:55 AM
To fix this issue If you use the AssemblyInstaller class, it appears (although this doesn't seem to be documented) that it will, in general, ignore any passed savedState parameter and will instead deal with the INSTALLSTATE file instead (writing it during install, reading it during uninstall).
If you're unable to use it, for some reason, you can probably use a disassembly tool to extract the necessary code from its Uninstall method to perform the deserialization (I believe, and it appears so, that the specific serialization methods used vary between .NET versions, so I'd recommend using the one appropriate to whichever .NET version you're currently working with).
public override void Uninstall(IDictionary savedState)
{
    this.PrintStartText(Res.GetString("InstallActivityUninstalling"));
    if (!this.initialized)
    {
        this.InitializeFromAssembly();
    }
    string installStatePath = this.GetInstallStatePath(this.Path);
    if ((installStatePath != null) && File.Exists(installStatePath))
    {
        FileStream input = new FileStream(installStatePath, FileMode.Open, FileAccess.Read);
        XmlReaderSettings settings = new XmlReaderSettings {
            CheckCharacters = false,
            CloseInput = false
        };
        XmlReader reader = null;
        if (input != null)
        {
            reader = XmlReader.Create(input, settings);
        }
        try
        {
            if (reader != null)
            {
                NetDataContractSerializer serializer = new NetDataContractSerializer();
                savedState = (Hashtable) serializer.ReadObject(reader);
            }
            goto Label_00C6;
        }
        catch
        {
            object[] args = new object[] { this.Path, installStatePath };
            base.Context.LogMessage(Res.GetString("InstallSavedStateFileCorruptedWarning", args));
            savedState = null;
            goto Label_00C6;
        }
        finally
        {
            if (reader != null)
            {
                reader.Close();
            }
            if (input != null)
            {
                input.Close();
            }
        }
    }
    savedState = null;
Label_00C6:
    base.Uninstall(savedState);
    if ((installStatePath != null) && (installStatePath.Length != 0))
    {
        try
        {
            File.Delete(installStatePath);
        }
        catch
        {
            object[] objArray2 = new object[] { installStatePath };
            throw new InvalidOperationException(Res.GetString("InstallUnableDeleteFile", objArray2));
        }
    }
}

How can I change the location of an .InstallState file in a Visual Studio generated MSI


Tag : .net , By : goffi
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Asp.net Report Viewer impersonation
  • Trouble upgrading to .NET 4 with VS2008. What am I missing?
  • If we cannot retrieve output parameters until SqlDataReader is closed, then why...?
  • .NET Message Queuing using SQL Server as Message Storage
  • Implement LINQ to Entities unsupported method
  • How do I get Nant to use the 4.0 compiler to target .Net 3.5
  • Monitor disk activity programmatically (Windows)
  • Windows Azure Platform, latest version?
  • Is SQL server the best DB for Storing and comparing images in database for a small ecommerce application
  • Remapping of Database from one server to other TFS-2018
  • SQL Server: Dynamically create Column Names from JSON Auto Data
  • Is it possible to Install .net 4.7 version on my machine when .net 4.8 is already installed?
  • Getting server absolute path in .NET core 2.1
  • Regex to find last word (including symbols) on line
  • Adding element to a couchbase database with f# code
  • How to create "NuGet Package Management Project" for .NET Standard?
  • Blazor BaseURI http vs https issue
  • Does X590Certificate.Build use OCSP if ChainPolicy RevocationMode Online is used?
  • Error "NU3034 This package is signed but not by a trusted signer"
  • Blazor .net version compatibility issues
  • How to test async Task method
  • this project doesn't know how to run the profile docker
  • Azure Cloud Storage SDK UploadFromStreamAsync storing 0 bytes
  • What is the Relaese date for Microsoft Orleans which can support service fabric?
  • Make a string persistent in a .NET application
  • How do I configure Cosmos DB .NET 3.0 SDK to serialize with camel case?
  • Service segmentation fault in AWS EC2
  • How to avoid the compilation error with inconsistent accessibility of class and methods?
  • "Does not implement IControllerFactory.CreateController" in Visual Studio 2010
  • Tabs for a ASP.NET website
  • AccountManagement.UserPrincipal.Current takes 5 seconds
  • Will linq to sql work in an asp.net 2.0 web application?
  • .Net Regular Expression to get parenthetical text at end of <p> tags
  • The Project Location is Not Trusted error in Visual Studio
  • how to tell if a photo was taken in landscape or portrait? JPEG .NET metadata orientation
  • Winform and ValidateChildren()
  • Why need to mention "Supported by the .NET Compact Framework" for classes members?
  • Pass MSI parameters to .NET installer class
  • How to print stack trace of StackOverflowException
  • OnPropertyChange as an Alternative to Triggers in Entity Framework
  • "User Friendly" .net compatible Regex/Text matching tools?
  • Non-Ascii characters not supported by .net?
  • Linq SqlMethods.Like fails
  • To check whether the SQL server DB is working properly or not
  • What is the Difference between GC.GetTotalMemory(false) and GC.GetTotalMemory(true)
  • Which version of .NET is available for Xbox 360?
  • Validation (with custom ErrorTemplate) for a DataTemplate
  • is the threadpool shared - .net
  • WPF RichTextBox - Formatting of typed text
  • "ResizeEnd" equivalent for usercontrols
  • How work with common utils project
  • Using image resource in XAML markup?
  • How to use XML namespace prefixes without xmlns="..." everywhere? (.NET)
  • How to write an altered COM Structured Storage file to Disk?
  • Implementing auditing using Autofac if it support method interception?
  • How can a static class be resolved by the Unity Framework?
  • How to flush DNS cache in Windows Mobile programmatically?
  • how to set autoplay=true in google audio player?
  • Edit dialog, with bindings and OK/Cancel in WPF
  • What does MailMessage.IsBodyHtml do?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com