Olter
Olter

Reputation: 1139

Launching .vsto file after installation. (InstallShield)

I have an msi installer, made via InstallShield, which moves some files to required location, writes some info to registry and installes VSTO runtime. But I need to launch the .vsto file, that is installed with the application, after the installation is over. Can I do this with custom actions? If that file was an .exe file, that would be rather easy, but how could I launch a .vsto file?
[upd]

Well, may be there is an easier solution: Can I just call the function:
public override void Install(IDictionary stateSaver)
from InstallShield? Something like that: Custom Action->Call a function in a Windows Installer dynamic link library->stored in binary table=>
AssemblyFile = \InclusionListCustomActions.dll MethodSignature = InclusionListCustomActions.TrustInstaller.Install(but what parameter goes here?)

Upvotes: 1

Views: 6175

Answers (2)

Christopher Painter
Christopher Painter

Reputation: 55601

You shouldn't launch the VSTO file because this will only install it per-user. What you should do is add it to the AddIns registry key for the office application you need and use the |vstolocal attribute to tell it to not deploy to the click once cache.

Upvotes: 3

Brijesh Mishra
Brijesh Mishra

Reputation: 2748

you can follow steps described in http://msdn.microsoft.com/en-us/library/cc563937%28v=office.12%29.aspx, you can copy same steps in Installshield, After file is copied and registry value set as specified, on starting office app it will automatically pick up vsto file

To add information to inclusion list you will have to write a console application and then call console app from installshield. Below code will help

            string RSA_PublicKey = @"<RSAKeyValue><Modulus></Modulus></RSAKeyValue>";
            //get this key from .vsto file
            try
            {
                SecurityPermission permission =
                    new SecurityPermission(PermissionState.Unrestricted);
                permission.Demand();
            }
            catch (SecurityException)
            {
                Console.WriteLine(
                    "You have insufficient privileges to " +
                    "register a trust relationship. Start Excel " +
                    "and confirm the trust dialog to run the addin.");
                Console.ReadLine();
            }
            Uri deploymentManifestLocation = null;
            var excelPath = YourAPPPath;              
            if (Uri.TryCreate(excelPath,
                UriKind.RelativeOrAbsolute, out deploymentManifestLocation) == false)
            {
                Console.WriteLine(
                    "The location of the deployment manifest is missing or invalid.");
                Console.ReadLine();
            }

            if (!File.Exists(excelPath))
            {
                UserInclusionList.Remove(deploymentManifestLocation);
                Console.WriteLine(deploymentManifestLocation.ToString() + "removed from inclusion list");

            }
            else
            {
                AddInSecurityEntry entry = new AddInSecurityEntry(
                          deploymentManifestLocation, RSA_PublicKey);
                UserInclusionList.Add(entry);
                Console.WriteLine(deploymentManifestLocation.ToString() + "Added to inclusion list");                  
            }

Upvotes: 0

Related Questions