Fernando,

Thanks, that's very interesting. But your example didn't work for me out
of the box:

d:\projects\assembly1\assembly2\test.cs(8,2): error CS0647: Error
emitting 'Assembly1.BuildAttribute' attribute -- 'Unexpected exception
processing attribute -- System.Security.SecurityException: Request for
the permission of type
System.Security.Permissions.EnvironmentPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed.

The state of the failed permission was: 
<IPermission class="System.Security.Permissions.EnvironmentPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
             version="1"
             Read="UserName"/>
.'

However, I'm running as non-admin, may be this is the reason. If I
remove Environment.UserName all works fine. So at least getting build
date/time works. Cool!

Sincerely, Ilya Ryzhenkov 

> -----Original Message-----
> From: Unmoderated discussion of advanced .NET topics. 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Fernando Tubio
> Sent: Saturday, January 29, 2005 3:29 AM
> To: [email protected]
> Subject: Re: [ADVANCED-DOTNET] Determing time when a assembly 
> was built
> 
> Actually, it is possible during the build process to use a 
> custom attribute to embed a build timestamp, or other 
> metadata for that matter. The only requirement is that it has 
> to be a custom permission attribute, which do get 
> instantiated during compilation time. Granted, this is a very 
> obscure solution, and probably not very practical, but what 
> did you expect for a Friday afternoon?

===================================
This list is hosted by DevelopMentor�  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to