Hello,

I have a simple VS2010 C# project that consists of:-


ISOTest.exe - The only assembly representing the main application which is 
installed in the ProgramFiles folder using WIX. This has a public class:-


    public class ExposeIsolatedStorage
    {
        public static IsolatedStorageFile GetIsolatedStorage()
        {
            return IsolatedStorageFile.GetMachineStoreForAssembly();
        }
    }

A "RemotingConfig.xml" file which will be copied to the ISO area by the C# 
Custom Action. A shortcut to this ISOTest project file is included in the C# 
Custom Action project.

A C# Custom Action which has one method:-

namespace CustomAction
{
    public class CustomActions
    {
        [CustomAction]
        public static ActionResult CreateServerConfig(Session session)
        {
            session.Log("Start CustomAction CreateServerConfig()");

            IsolatedStorageFileStream isoFileStream = null;
            IsolatedStorageFile store = null;

            try
            {
                // Get Isolated storage for ISOTest assembly which is the 
installing application exe.
                store = ISOTest.ExposeIsolatedStorage.GetIsolatedStorage();
               isoFileStream = new 
IsolatedStorageFileStream("RemotingConfig.xml", FileMode.Create, store);

                // Display ISOTest Assembly identity.
                MessageBox.Show("CustomAction CreateServerConfig(): " + 
store.AssemblyIdentity.ToString());

                session.Log("CustomAction CreateServerConfig():-\r\n " + 
store.AssemblyIdentity.ToString());

                if (File.Exists("RemotingConfig.xml"))
                {
                    XDocument doc = XDocument.Load("RemotingConfig.xml");
                    doc.Save(isoFileStream);
                    MessageBox.Show("Project xml File found and copied to 
isolated storage");
                }
                else
                {
                    MessageBox.Show("Project xml File not found");
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("CustomAction CreateServerConfig()", 
ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (isoFileStream != null)
                {
                    isoFileStream.Close();
                }

            }

            session.Log("End CustomAction CreateServerConfig()");

            return ActionResult.Success;
        }
    }
}

     The WIX xml portion:-

    <Binary Id="CustomActionsDLL" 
SourceFile="$(var.CustomAction.TargetDir)CustomAction.CA.dll"/>

    <CustomAction Id="CA_CreateServerConfig" BinaryKey="CustomActionsDLL" 
DllEntry="CreateServerConfig" Execute="immediate" Return="check"/>

    <InstallExecuteSequence>
      <Custom Action="CA_CreateServerConfig" Before="InstallFinalize">NOT 
INSTALLED</Custom>
    </InstallExecuteSequence>


This works perfectly for a VS2010 DEBUG build with the ISO store being created 
using the C# Custom Action. When the installed application is executed it 
accesses the same ISO created during installation. (This is verified by looking 
at the assembly identity message box prompts in the C# Custom Action).

The problem is after a VS2010 RELEASE build that this fails with the C# Custom 
Action creating its own ISO. This consequently results in the ISOTest 
application creating another ISO area which obviously does not contain the 
RemotingConfig.xml file.

Both C# assemblies are strongly typed in VS using the same .snk file.

The idea was to have the installer create an ISO area and then copy a 
config.xml (remoting object configuration) to that location which can then be 
accessed by the application. A further C# Custom Action method will then be 
used to delete this ISO area during an uninstall. The target platforms are 
Windows 7 and 2008 Server.

This will only work when doing a VS DEBUG build. I would really appreciate some 
advice here as I've trawled the web to find an answer, with no luck.

Cheers,
Paul


-- 
Scanned by iCritical.

------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to