I'd like to including a json file to store some setting for the Add-in to read when it's loading. How should I do it? I've added it in the visualstudio solution, when it's compiled it's not ditributed with the add-in.
You need to set your json file's properties (in your project file) to 'Build Action' = 'Content' and 'Copy to Output...' = 'Copy if Newer'
Then in your Add-in use the following path to read the json file:
// read the JSON file from the current assembly's executable folder string asmblyPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string jsonFilePath = System.IO.Path.Combine(asmblyPath, "MyJsonFile.json"); // read the JSON file string jsonString = System.IO.File.ReadAllText(jsonFilePath);
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.