cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
j_alza
Level 4

How to configure to use local storage?

Hello,

I'm upgrading one of my projects from VS2005 to VS2013. I have a setup project in my solution, but this is no longer supported and I have to change to InstallShield deployment project. With the old setup project my app runs fine, but now with InstallShield I have a problem. I install the application in this folder: C:\Program Files (x86)\CompanyName\AppName. I use .config file to read and write some parameters. Reading parameters goes well, but when I write new values in the .config file a get one error. When I used the old setup project, at writing time the system created new .config file in C:\Users\me\AppData\Local\VirtualStore\Program Files (x86)\CompanyName\AppName (local storage).

This is the exception:

Exception messsage:
An error occurred loading a configuration file: Access to the path 'C:\Program Files (x86)\CompanyName\AppName\oy25i1se.tmp' is denied. (C:\Program Files (x86)\CompanyName\AppName\ExeFile 1.0.192b.exe.config)
Stack trace:
at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)
at System.Configuration.Configuration.SaveAsImpl(String filename, ConfigurationSaveMode saveMode, Boolean forceSaveAll)
at System.Configuration.Configuration.Save()
at VisualizadorCabecera.FormPrincipal.EstablecerIdioma(CultureInfo idioma)

Inner exception messsage:
Access to the path 'C:\Program Files (x86)\CompanyName\AppName\oy25i1se.tmp' is denied.
Stack trace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at System.CodeDom.Compiler.TempFileCollection.EnsureTempNameCreated()
at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension, Boolean keepFile)
at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension)
at System.Configuration.Internal.WriteFileContext..ctor(String filename, String templateFilename)
at System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForWrite(String streamName, String templateStreamName, Object& writeContext, Boolean assertPermissions)
at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForWrite(String streamName, String templateStreamName, Object& writeContext, Boolean assertPermissions)
at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForWrite(String streamName, String templateStreamName, Object& writeContext)
at System.Configuration.ClientConfigurationHost.OpenStreamForWrite(String streamName, String templateStreamName, Object& writeContext)
at System.Configuration.UpdateConfigHost.OpenStreamForWrite(String streamName, String templateStreamName, Object& writeContext)
at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)

Any sugestions?

Thank you,
Jon.
0 Kudos

(1) Reply
j_alza
Level 4

Finally I have used .settings file instead of .config file to solve this problem.
0 Kudos