Get the data from the "Version" Tab in Dll properties with c# code? - assemblies

I want to get the FileVersion (or ProductVersion) and the Comments fields which are in the "Version" tab of a dll using a c# code.
I tried to use the Assembly class, but didn't find the data I need.
Thanks in Advance.

That's because the Assembly only knows the AssemblyVersion. To get File information, you need to look at the file properties using FileVersionInfo.

Related

Does ASP.NET Membership Provide a Way to Access the aspnet_Profile Table

I would like to be able to retrieve a value of one of the concatenated string properties (PropertyNames column) for the logged in user.
I looked through the Membership class but could not find any way so far.
Any idea? And what would be the best approach?
Got it! Using System.Web.Profile.
Found the following link helpful about extracting individual properties.
Also, the app was throwing the following error:
Could not load type 'System.Web.Security.SqlProfileProvider'
A change was needed to be made in the Web.Config file
The following link pointed to the main issue

ASP.NET Read Resources values

I have two .resx files: en.resx and he.resx, in the folder App_LocalResources.
I already have two buttons in my web page, clicking each one is supposed to "switch" to the other language's resource file.
I want to simply get a string value located in one of the .resx files.
I tried some of the examples I have found on google, and I asked myself, why do I need to provide an Assembly type and a namespace, when i just want to ask for a string value in my own project?
Why isn't there something like: string val = Resources["en.resx"]["SomeProperty"].Value?
Maybe my whole approach is wrong, and I would like to read your opinions.
Thanks, Guy
using System.Resources;
ResXResourceSet Resource = new ResXResourceSet(HttpContext.Current.Server.MapPath(#"~/Properties/Resource.resx")
String value=Resource.GetStrin("key");

Deleting template column

Im using ASP.NET, with c#, with visual studio 2008.
I have a datagrid, and I have a Template column in the datagrid.
I have copied the datagrid from another .aspx. The template column is made for delete purposes(rows of data results),
but I don't need this template column anymore. So I have tried removing it. But when executing I get the error:
"System.ArgumentOutOfRangeException = specified argument was out of range. parameter name index."
The error is thrown when it reaches the line: DataGrid1.DataBind();
How can i fix this ?
Thanks..
I solved it. I had to modify some methods which were called in the InitializeComponent().
Thanks!

web.config, configSource, and "The 'xxx' element is not declared" warning

I have broken down the horribly unwieldy web.config file into individual files for some of the sections (e.g. connectionStrings, authentication, pages etc.) using the configSource attribute.
This is working fine, but the individual xml files that hold the section 'snippets' cause warnings in VS.
For example, a file named roleManager.config is used for the role manager section, and looks like this:
<roleManager enabled="false">
</rolemanager>
However I get a blue squiggle under the roleManager element in VS, and the following warning: The 'roleManager' element is not declared
I guess this is something to do with valid xml and schemas etc. Is there an easy way to fix this? Something I can add to the individual files?
Thanks
P.S. I have heard that it is bad practice to break the web.config file out like this. But don't really understand why - can anyone illuminate me?
Searching a workaround to this matter using Custom Config Files, I found this solution. Dont know if is the correct one.
The problem is that VS cant find a schema to validate your .config (xml). If you are using "native" configuration elements or when you create your custom .config files you must set to every xml document a schema.
By default (in VS9 for example) all xml files use \Microsoft Visual Studio 9.0\Xml\Schemas\DotNetConfig.xsd
but you can add more schemas to use.
Before assigning a schema you must create it.
To create a new Schema based on your own custom.config:
open your custom config file
in menubar XML->Create Schema
save it
To assign your schema:
open your custom config file
in properties panel: click on the browse button [..]
set the 'Use' column to your recently created schema
you can assign as many you want. or have one schema for all your different custom .config files
(Sorry, but my English is not so good)
I think that you get the blue squiggles since the schema of your web.config file doesn't declare these custom config sections that you've 'broken out' into individual files.
In investigating this, I see that some of my solutions have the same issue, but the config sections that are provided from microsoft DON'T have the squiggles. eg: we have extracted the appsettings and connectionstrings out into their own files, and they don't get the squiggles, but our custom ones do.
I tried to view the microsoft schema at schemas.microsoft.com/.netconfiguration/v2.0, but I get a 404 when trying to download it.
What I'm trying to say is if you get a copy of the MS schema and alter it to include your external config files, you should be able to get rid of the dreaded squiggles!
HTH,
Lance

Is it possible to create a .ascx virtually? i.e. not on disk, but as a string?

I was wondering if it was possible to load a asp.net control (.ascx) that doesn't reside on the file system?
Like say a string variable?
Not a string varible but you can load it from resources or zip file, but you have to have full trust. Google for VirtualPathProvider.
As of 4.0 you don't have to have full trust.
System.Reflection.Emit
Assembly.Load(byte[])
No designer for you if you do this though.
You could try this:
string controlString = //read or build it
Control control = this.Page.TemplateControl.ParseControl(controlString);
More information is available here:
http://msdn.microsoft.com/en-us/library/kz3ffe28.aspx

Resources