473,320 Members | 1,951 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.

Retrieving Application Information?

Is there a way to retrieve a WinForms application information such as
Company, Product and Version from within a
class library ( DLL ) that the Winforms application is using. Specificly the
applications specfic ApplicationData directory.
This is not a problem from within the application, all you need to do is use
Application.UserAppDataPath but I need this
same location from inside the class library ( DLL ). C# example would be
nice! Thanks....

Orgbrat

Jan 27 '06 #1
2 4429
You can set this information using the appropriate tags in the
Assemblyinfo.cs class file. You can retrieve it using the appropriate
methods such as GetCustomAttributes.

Here's a short snippet that gets the AssemblyConfiguration item:

private string buildMode=String.Empty;
private void Page_Load(object sender, System.EventArgs e)
{
Assembly asm = Assembly.GetExecutingAssembly();
object[] objArray=asm.GetCustomAttributes(false) ;
foreach (object obj in objArray)
{
AssemblyConfigurationAttribute conf =
obj as AssemblyConfigurationAttribute;
if (conf != null)
this.buildMode=conf.Configuration ;
}
Response.Write("Build Mode: " +this.buildMode);
}

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Orgbrat" wrote:
Is there a way to retrieve a WinForms application information such as
Company, Product and Version from within a
class library ( DLL ) that the Winforms application is using. Specificly the
applications specfic ApplicationData directory.
This is not a problem from within the application, all you need to do is use
Application.UserAppDataPath but I need this
same location from inside the class library ( DLL ). C# example would be
nice! Thanks....

Orgbrat

Jan 27 '06 #2
Hi Peter,
Thank you very much for your input. I just needed a push in the right
direction. I needed to use the
Assembly.GetEntryAssembly() call instead of the
Assembly.GetExecutingAssembly() call to find what
I needed. Thanks a very lot you were a great help.

Orgbrat

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:8E**********************************@microsof t.com...
You can set this information using the appropriate tags in the
Assemblyinfo.cs class file. You can retrieve it using the appropriate
methods such as GetCustomAttributes.

Here's a short snippet that gets the AssemblyConfiguration item:

private string buildMode=String.Empty;
private void Page_Load(object sender, System.EventArgs e)
{
Assembly asm = Assembly.GetExecutingAssembly();
object[] objArray=asm.GetCustomAttributes(false) ;
foreach (object obj in objArray)
{
AssemblyConfigurationAttribute conf =
obj as AssemblyConfigurationAttribute;
if (conf != null)
this.buildMode=conf.Configuration ;
}
Response.Write("Build Mode: " +this.buildMode);
}

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Orgbrat" wrote:
Is there a way to retrieve a WinForms application information such as
Company, Product and Version from within a
class library ( DLL ) that the Winforms application is using. Specificly
the
applications specfic ApplicationData directory.
This is not a problem from within the application, all you need to do is
use
Application.UserAppDataPath but I need this
same location from inside the class library ( DLL ). C# example would be
nice! Thanks....

Orgbrat

Jan 27 '06 #3

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

Similar topics

8
by: Steve | last post by:
Can anyone tell me the preferred method for writing and retrieving persistent information using .Net. Specifically, I am referring to information that you used to see in registry keys or .ini...
6
by: Ian Williamson | last post by:
Greetings, My company has an ASP.NET based enterprise product that is undergoing some changes and I need some community input to help solve a problem. In the current implementation, any given...
2
by: Sakke | last post by:
Hello! We have written a GCryptoSvr.dll COM server in C++. Inside that resides WebClient COM component. WebClient CLSID is {8DC27D48-F94C-434B-A509-C3E1A3E75B9E}. When we are using that...
0
by: Rob Meade | last post by:
Hi all, I have some code which we use to retrieve an assembly version of a referenced assembly in our proects, this information is displayed in our footer part of our template. I've just...
3
by: Navodit | last post by:
Hi I have a very basic question regd retrieving information from website using a scripting language: Basically I am working on the development of a database where a user enters an address...
1
by: jimmyfo | last post by:
Hi, I recently wrote an ASP.Net web application in VS2005 and published (using VS2005 Publish feature) it to a relatively clean machine with ASP.Net 2.0 and MDAC 2.8 installed on it. However, when...
11
by: Nemisis | last post by:
Hi everyone, sorry if this post gets really long, i just wanna make sure i fully explain what i am trying to do. I am new to OOP and .net 2.0, so if this is obvious, i am sorry. I have wrote a...
3
by: Michel Vanderbeke | last post by:
Hello, While logging the errors in my program, I want to know in which class, function or procedure they occured. Is it possible to know the name of the class, function and / or procedure in...
3
by: Bruno Vignola | last post by:
Good Morning all, I need to interoperate with the Calendar of MS Outlook 2003 (inserting, retrieving, listing events, etc. etc.) from an ASP.NET application; I first developed a simple windows...
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...
0
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...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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....

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.