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);
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.