.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

User.Config file location

4 REPLIES 4
Reply
Message 1 of 5
ctbertschy
2267 Views, 4 Replies

User.Config file location

I have begun using the awesome power of the user.config file for form control data and general setting; However, I have been led to believe that the user.config file is always saved either internally with the app.config file or in its own user.config file. When I run the compiled project internally in autocad, it places this config file in

"C:\Documents and Settings\CBertschy\Local Settings\Application Data\Autodesk,_Inc\DefaultDomain_Path_t1bctulb1i5ssljxkt3ct1iwqz15swl2\R17.1.219.3".

I am not down with this and would like the file to be saved in the location of my DLL. I would not mind it storing in the user document and settings file but would like it under my projects name and not the current location. I can not find anything to control this behavior and I think it has to do with the file having to be in run in autocad's namespace. I am using the default config file and not a custom config.

Is there any way around this, should I change back to a custom config file?

Thanks

--cbertschy
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: ctbertschy

The config files are not automatically saved in DLL projects,
only in .EXE's, so you have to do it yourself manually.

You can save your appsettings from an IExtensionApplication's
Terminate() method.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");


wrote in message news:6232376@discussion.autodesk.com...
I have begun using the awesome power of the user.config file for form
control data and general setting; However, I have been led to believe that
the user.config file is always saved either internally with the app.config
file or in its own user.config file. When I run the compiled project
internally in autocad, it places this config file in

"C:\Documents and Settings\CBertschy\Local Settings\Application
Data\Autodesk,_Inc\DefaultDomain_Path_t1bctulb1i5ssljxkt3ct1iwqz15swl2\R17.1.219.3".

I am not down with this and would like the file to be saved in the location
of my DLL. I would not mind it storing in the user document and settings
file but would like it under my projects name and not the current location.
I can not find anything to control this behavior and I think it has to do
with the file having to be in run in autocad's namespace. I am using the
default config file and not a custom config.

Is there any way around this, should I change back to a custom config file?

Thanks

--cbertschy
Message 3 of 5
ctbertschy
in reply to: ctbertschy

The save() method works but saves the config file in the directory I posted. I have tried the save method in various parts of code with the same result. It will only read from the crazy directory for the config file. I have tried puting the generated dl.config, app.config, and usre config file with the net loaded dll but it will only use the one in the crazy directory. I was wondering how to control the location from which the appconfig file is read and where it saves. The save method does not support a directory path and I can't seem to find a way to force it to read from any other.

I have yet to experiment with a custom properties config file and would prefer the default unless that is the only answer.

Thanks

--cbertschy
Message 4 of 5
norman.yuan
in reply to: ctbertschy

User.config is PER USER based configuration. That is why it is automatically saved in ...\document and sessions\username\...... and with "crazy" path name, because Windows (.NET runtime) has to figure it out according to the user, application... to make sure it is used by certain user for certain application.

What you really want (according to your description) is application level configuation, which would be shared by all users who use your application in the computer. So, you really should use xxx.exe.config. In the case of AutoCAD, it is acad.exe.config.

Or you can use other means to determine where you store/find your own custom configurable data, as Tony suggests, implementing IExtensionApplication's Initilize()/Terminate() to get and save your settings. For example, you can use System.Reflection.Assembly to determine where the DLL is loaded from, and then read/save your own setting file from there. Of course, the setting is on application level, not per user.

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 5
ctbertschy
in reply to: ctbertschy

Thanks, I will look at implementing the IExtensionApplication. I was tired of beating a dead horse trying to implement the visual studio boiler plate stuff. I am okay with the application level for now but might as well implement user support if I am going to choose a place for the file and it will not have to be next to the DLL. I guess I will need to create a custom installer for this as well.

Thanks again

--cbertschy

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost