I am trying set up my addin to read folder name and path from app.config file.
using ConfigurationManager.AppSettings to get the value.
this is giving me an error.(attached image)
public classAppConfig : IExternalCommand
{
publicResult Execute(ExternalCommandData commandData, refstring message, ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Autodesk.Revit.ApplicationServices.
Application app = uiapp.Application;
Document doc = uidoc.Document;
string dir = ConfigurationManager.AppSettings["pdfOutput"];
TaskDialog.Show(dir, dir);
returnResult.Succeeded;
}
}
<?
xmlversion="1.0"encoding="utf-8" ?>
<
configuration>
<
configSections>
<
sectionGroupname="userSettings"type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<
sectionname="BabuRevitAPI.HCL"type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"allowExeDefinition="MachineToLocalUser"requirePermission="false" />
<
sectionname="BabuRevitAPI.Settings"type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"allowExeDefinition="MachineToLocalUser"requirePermission="false" />
</
sectionGroup>
</
configSections>
<
userSettings>
<
BabuRevitAPI.HCL>
<
settingname="pdfOutput"serializeAs="String">
<
value>pdf outt put folder</value>
</
setting>
<
settingname="auslocal"serializeAs="String">
<
value>aus local folder</value>
</
setting>
<
settingname="test"serializeAs="String">
<
value>I am a test</value>
</
setting>
</
BabuRevitAPI.HCL>
</
userSettings>
</
configuration>
Solved! Go to Solution.
Solved by rosalesduquej. Go to Solution.
Hello, I have resolved your issue, you can check out the blog post I did on it, if you have any more questions feel free to ask them.
http://adndevblog.typepad.com/aec/2014/09/get-value-from-appconfig-file-and-sur-la-france.html
Cheers,