473,320 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

can vb.net2003 create config file in bin directory?

Hello,

I picked up this example on using the Reflection namespace
for loading forms/classes on the fly at msdn

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnadvnet/html/vbnet10082002.asp

which uses a config file named "yourAppName.exe.config"
which is an xml based config file that references dlls in
other projects to load their forms/classes on the fly.
This config file resides in the bin directory of the
app's .exe. The example works great (although written in
vb.net2002 - for vb.net2003 need to instantiate a var:
ClassConfigValues = New Specialized.NameValueCollection )

The problem I am having is that when I run the app in
debug mode - the app's bin gets recreated each time, and I
have to manually recreate/copy the config file into the
bin. The config file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="availableclasses"
type="System.Configuration.NameValueSectionHandler " />
</configSections>
<availableclasses>
<add key="First Form"
value="C:\Newforms\FirstForm.dll~FirstForm.Form1"> </add>
<add key="Second Form"
value="C:\Newforms\SecondForm.dll~SecondForm.Form1 "></add>
<add key="Third Form"
value="C:\Newforms\ThirdForm.dll~ThirdForm.Form1"> </add>
</availableclasses>
</configuration>

Is there a way for vb.net2003 to add this config file to
the bin at rebuild time? Or is it a deal where you create
the app and manually add the file yourself?

Thanks,
Rich

Nov 20 '05 #1
6 2245
jim
hi rich,

just add the config file to your solution with the (default) name of
App.Config... when you build your project/solution App.Config will be
automatically renamed and moved to the bin directory.

hope this helps,

jim

"Rich" <an*******@discussions.microsoft.com> wrote in message
news:59****************************@phx.gbl...
Hello,

I picked up this example on using the Reflection namespace
for loading forms/classes on the fly at msdn

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnadvnet/html/vbnet10082002.asp

which uses a config file named "yourAppName.exe.config"
which is an xml based config file that references dlls in
other projects to load their forms/classes on the fly.
This config file resides in the bin directory of the
app's .exe. The example works great (although written in
vb.net2002 - for vb.net2003 need to instantiate a var:
ClassConfigValues = New Specialized.NameValueCollection )

The problem I am having is that when I run the app in
debug mode - the app's bin gets recreated each time, and I
have to manually recreate/copy the config file into the
bin. The config file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="availableclasses"
type="System.Configuration.NameValueSectionHandler " />
</configSections>
<availableclasses>
<add key="First Form"
value="C:\Newforms\FirstForm.dll~FirstForm.Form1"> </add>
<add key="Second Form"
value="C:\Newforms\SecondForm.dll~SecondForm.Form1 "></add>
<add key="Third Form"
value="C:\Newforms\ThirdForm.dll~ThirdForm.Form1"> </add>
</availableclasses>
</configuration>

Is there a way for vb.net2003 to add this config file to
the bin at rebuild time? Or is it a deal where you create
the app and manually add the file yourself?

Thanks,
Rich

Nov 20 '05 #2
Cool! I learned something new. That worked great. One
question though on this example. The big deal is that it
says with Reflection you can instantiate forms/classes on
the fly which are created later and in a different
project. But from what I understand, you have to include
a reference to these new objects in the config file which
suggests that you will have prior knowledge of the
existence of these objects. Wait. I think I am answering
my own question - you can add this config file at a later
time. So my original question of do you manually plant
the config would be either or. I could include a config
file in the solution or I could add a config file after
the fact. Well, anyway, I learned something :). I guess
the real deal is to stuff these two guys for just-in-case.

Imports System.Configuration
Imports System.Reflection

Rich

-----Original Message-----
hi rich,

just add the config file to your solution with the (default) name ofApp.Config... when you build your project/solution App.Config will beautomatically renamed and moved to the bin directory.

hope this helps,

jim

"Rich" <an*******@discussions.microsoft.com> wrote in messagenews:59****************************@phx.gbl...
Hello,

I picked up this example on using the Reflection namespace for loading forms/classes on the fly at msdn

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnadvnet/html/vbnet10082002.asp

which uses a config file named "yourAppName.exe.config"
which is an xml based config file that references dlls in other projects to load their forms/classes on the fly.
This config file resides in the bin directory of the
app's .exe. The example works great (although written in vb.net2002 - for vb.net2003 need to instantiate a var:
ClassConfigValues = New Specialized.NameValueCollection )
The problem I am having is that when I run the app in
debug mode - the app's bin gets recreated each time, and I have to manually recreate/copy the config file into the
bin. The config file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="availableclasses"
type="System.Configuration.NameValueSectionHandler " />
</configSections>
<availableclasses>
<add key="First Form"
value="C:\Newforms\FirstForm.dll~FirstForm.Form1"> </add>
<add key="Second Form"
value="C:\Newforms\SecondForm.dll~SecondForm.Form1 "></add> <add key="Third Form"
value="C:\Newforms\ThirdForm.dll~ThirdForm.Form1"> </add>
</availableclasses>
</configuration>

Is there a way for vb.net2003 to add this config file to
the bin at rebuild time? Or is it a deal where you create the app and manually add the file yourself?

Thanks,
Rich

.

Nov 20 '05 #3
* "Rich" <an*******@discussions.microsoft.com> scripsit:
which uses a config file named "yourAppName.exe.config"
which is an xml based config file that references dlls in
other projects to load their forms/classes on the fly.
This config file resides in the bin directory of the
app's .exe. The example works great (although written in
vb.net2002 - for vb.net2003 need to instantiate a var:
ClassConfigValues = New Specialized.NameValueCollection )

The problem I am having is that when I run the app in
debug mode - the app's bin gets recreated each time, and I
have to manually recreate/copy the config file into the
bin. The config file looks like this:


Rename the file to "App.config", put it in the project's source folder
and add it to the project. VS.NET will automatically copy the file to
the "bin" directory and rename it appropriately.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Nov 20 '05 #4
Thank you. I did that now, and it worked fine. May I ask
if it is possible to create/generate an App.Config file
from within the code? For example, if I have an already
existing app (with all the required imports), and I want
to reference some new objects (forms/classes) from another
project, can I input their information into my existing
app like through a form textboxes such as to generate the
config file on the fly or does that require recompiling?
Or is it possible to just create/generate an app.config
file from within the code at all?

Thanks,
Rich
-----Original Message-----
* "Rich" <an*******@discussions.microsoft.com> scripsit:
which uses a config file named "yourAppName.exe.config"
which is an xml based config file that references dlls in other projects to load their forms/classes on the fly.
This config file resides in the bin directory of the
app's .exe. The example works great (although written in vb.net2002 - for vb.net2003 need to instantiate a var:
ClassConfigValues = New Specialized.NameValueCollection )
The problem I am having is that when I run the app in
debug mode - the app's bin gets recreated each time, and I have to manually recreate/copy the config file into the
bin. The config file looks like this:
Rename the file to "App.config", put it in the project's

source folderand add it to the project. VS.NET will automatically copy the file tothe "bin" directory and rename it appropriately.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
.

Nov 20 '05 #5
* "Rich" <an*******@discussions.microsoft.com> scripsit:
Thank you. I did that now, and it worked fine. May I ask
if it is possible to create/generate an App.Config file
from within the code? For example, if I have an already
existing app (with all the required imports), and I want
to reference some new objects (forms/classes) from another
project, can I input their information into my existing
app like through a form textboxes such as to generate the
config file on the fly or does that require recompiling?
Or is it possible to just create/generate an app.config
file from within the code at all?


You won't need to recompile, that's the main advantage of a config
file. Nevertheless, config files should not be used to store user
preferences. You can edit them with .NET's 'System.Xml' classes.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Nov 20 '05 #6
Rich,
I normally include a skeleton config file when I deploy my app, then add new
specific types later.

As normally I am either loading a collection of dynamic types, using a
DictionarySectionHandler. Or I have a "default" implementation of a single
dynamic type, that the end user is able to replace later.

Also giving the skeleton config file, allows the end user (and me!) to know
the correct syntax to use to add the new dynamic type later...

Hope this helps
Jay

"Rich" <an*******@discussions.microsoft.com> wrote in message
news:5d****************************@phx.gbl...
Cool! I learned something new. That worked great. One
question though on this example. The big deal is that it
says with Reflection you can instantiate forms/classes on
the fly which are created later and in a different
project. But from what I understand, you have to include
a reference to these new objects in the config file which
suggests that you will have prior knowledge of the
existence of these objects. Wait. I think I am answering
my own question - you can add this config file at a later
time. So my original question of do you manually plant
the config would be either or. I could include a config
file in the solution or I could add a config file after
the fact. Well, anyway, I learned something :). I guess
the real deal is to stuff these two guys for just-in-case.

Imports System.Configuration
Imports System.Reflection

Rich

-----Original Message-----
hi rich,

just add the config file to your solution with the

(default) name of
App.Config... when you build your project/solution

App.Config will be
automatically renamed and moved to the bin directory.

hope this helps,

jim

"Rich" <an*******@discussions.microsoft.com> wrote in

message
news:59****************************@phx.gbl...
Hello,

I picked up this example on using the Reflection namespace for loading forms/classes on the fly at msdn

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnadvnet/html/vbnet10082002.asp

which uses a config file named "yourAppName.exe.config"
which is an xml based config file that references dlls in other projects to load their forms/classes on the fly.
This config file resides in the bin directory of the
app's .exe. The example works great (although written in vb.net2002 - for vb.net2003 need to instantiate a var:
ClassConfigValues = New Specialized.NameValueCollection )
The problem I am having is that when I run the app in
debug mode - the app's bin gets recreated each time, and I have to manually recreate/copy the config file into the
bin. The config file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="availableclasses"
type="System.Configuration.NameValueSectionHandler " />
</configSections>
<availableclasses>
<add key="First Form"
value="C:\Newforms\FirstForm.dll~FirstForm.Form1"> </add>
<add key="Second Form"
value="C:\Newforms\SecondForm.dll~SecondForm.Form1 "></add> <add key="Third Form"
value="C:\Newforms\ThirdForm.dll~ThirdForm.Form1"> </add>
</availableclasses>
</configuration>

Is there a way for vb.net2003 to add this config file to
the bin at rebuild time? Or is it a deal where you create the app and manually add the file yourself?

Thanks,
Rich

.

Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: ferg | last post by:
I've checked all the FAQs and help - spent a couple of hours on this now and it's really bugging me. I've got Moin 1.3.5 installed on IIS 5.0. I can view and edit pages without any problems, but...
9
by: ALI-R | last post by:
Hi,, I have two questions : 1) Is it mandatory that config file of a desktop application must be App.config 2) Is it possible to update config file in your code?? thanks for your help. ALI
2
by: Vicky via DotNetMonster.com | last post by:
Hi, Could anyone help me with some info how to create app.config file. I need to put code of directory info in there, Thank you very much! DirectoryInfo di = new DirectoryInfo("C:\\Vicky...
0
by: Zal | last post by:
have tried to follow the following instructions but to no success, hope someone can help me I have 2 servers server1 and server2. Server1 is the domain server, running sbs2003, i have gone to...
2
by: PMac | last post by:
I'm trying to execute a stand-alone console application from an aspx page when a use clicks a button on that page. On the aspx page is the following lines of pertinent code: private void...
10
by: robwharram | last post by:
Hi, I'm quite frustrated in the fact that I can't even display a simple "Hello World" message on .Net. I've been through all of the groups and searched all over the place and haven't been able...
9
by: Benny Ng | last post by:
Hi,all, How to let the sub-directory to avoid the authentication control from Root's webconfig? I heard that we can add a new web.config to the sub-directory. And then we can slove the problem....
2
by: Luke Dalessandro | last post by:
I have an application with the following layout /root/ /root/Default.aspx /root/web.config /root/child/ /root/child/web.config web.config has a custom configuration section "testSection"...
16
by: Mich | last post by:
Hi, i'm building an web application for anonymous users. They can take a look in the website, nothing more. In order to perform other actions, the anonymous user must be logged. So i create an...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.