Property AppDataPath
AppDataPath
Gets or sets the application data path for the runtime deployment used by this application.
Declaration
public string AppDataPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | A System.String representing the path to a folder on disk. |
Remarks
The folder specified by this property will contain data created by the runtime deployment which should be persisted between application sessions. The runtime deployment will write all application-related data to the folder specified by this property for the lifetime of the application. The property must be set each time your application starts but before the Initialize() method is called. Once the runtime deployment is initialized any attempt to set this property will result in an System.InvalidOperationException.
Any Map Packages (.MPK), Address Locator Packages (.GCPK) or Geoprocessing Packages (.GPK) used by your application in conjunction with the runtime local server are unpacked to this location. You should therefore consider how much space may be required by this folder when setting the property. Packages will be unpacked to "{AppDataPath}\Documents\ArcGIS\Packages". Other data written to the folder specified by this property can be considered internal to the runtime deployment and typically does not require significant disk space.
If not specified, TempPath will be used. It is therefore recommended that this property be set in order to differentiate the application data from that created by another runtime deployment. For example, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Vendor\MyAppName");
This property, in conjunction with the TempPath property enable you to have control over any application-related or temporary data created by the runtime deployment during use by your application and can help achieve a zero footprint implementation in which no files are left behind when the application is removed from or uninstalled from the deployment machine.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | AppDataPath cannot be set if the server is not stopped or failed state. |
System.ArgumentException | Path cannot be empty. |
System.IO.DirectoryNotFoundException | Folder location for 'AppDataPath' is not found. |
See Also
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Windows | 100.13 - 200.5 |
.NET Framework | 100.0 - 200.5 |