Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

get value from app.config file

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
10391 Views, 1 Reply

get value from app.config file

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>

1 REPLY 1
Message 2 of 2
rosalesduquej
in reply to: Anonymous

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,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community