views:

29

answers:

0

I've got an assembly in my framework, the purpose of which is to manage some data common to several applications that I am building. The assembly uses isolated storage to persist the data. The assembly itself happens to be a command-line .exe application and it can be executed directly as a tool to examine and make changes to the data.

One of the applications that references this assembly is a WPF application. The WPF application is able to access the common data by calling methods of the assembly which in turn get the data from isolated storage. This works fine. The data that the WPF application sees is consistent with the data seen when the assembly is executed directly as an application.

In the same solution, I am building another application which also references the assembly. This application is a command line application. When this application calls methods on the assembly, the isolated storage looks in a different directory and it doesn't find the data because the files that it is expecting to find don't exist.

My question is simply - why is this happening, and how can I get the behavior that I want?

Here is the gist of the code that I am using for writing:

        IsolatedStorageFileStream isoStream =
            new IsolatedStorageFileStream(
                theManifestFilename,
                FileMode.OpenOrCreate,
                FileAccess.Write,
                FileShare.Write,
                IsolatedStorageFile.GetMachineStoreForAssembly());

and for reading:

        IsolatedStorageFileStream isoStream =
            new IsolatedStorageFileStream(
                theManifestFilename,
                FileMode.Open,
                FileAccess.Read,
                FileShare.Read,
                IsolatedStorageFile.GetMachineStoreForAssembly());

I know that the directory being used by the third application is different because I can see it being created when I attempt to read the data for the first time. For example, when the assembly is executed directly as an executable or when it is used by the WPF application, isolated storage uses this directory:

C:\Documents and Settings\All Users\Application Data\IsolatedStorage\2yrvcpeu.m3j\ocfo5gt2.ie3\Url.n30pq3hljo3x1tjlhqhxfqgmlyotlvmy

When my command-line application uses the assembly, isolated storage uses this directory:

C:\Documents and Settings\All Users\Application Data\IsolatedStorage\2yrvcpeu.m3j\ocfo5gt2.ie3\Url.njpqi2yat5kmbqrcf2v5woada5tgww2v

which is only different at the last level in the path.

These are standalone applications. I'm building and testing these applications with VS2008 - typically debug builds. They are all in the same solution. I am running on Windows Server 2003 and building .NET Framework 3.5.

None of the assemblies or applications are signed.

I thought perhaps the problem was that the assemblies were getting different storage because of the different copies of the assemblies that VS makes when it builds an application. But that doesn't make sense because the WPF application seems to work fine, and it has its own copy of the assembly.

I'm out of ideas.

Thanks very much for any help!