By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,084 Members | 1,199 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,084 IT Pros & Developers. It's quick & easy.

Assembly.GetCustomAttributes Method

P: n/a
Hi to you all,
I'm using the following code (Code Sample 1) to determine whether an
assembly is
a BizTalk assembly or not. When I run the code in different machines I fount
that it does not always has the same results. I also tried the second code
sample (Code Sample 2)but still, I only got the attributes that are not
BizTalkAssembly attributes. My guess is that this has to do with permissions,
but I'm not quite sure in what way.

************************************************** **********
Code Sample 1:
this._btAsembly = Assembly.LoadFile(MyAssemblyPath);
object [] oa =
this._btAsembly.GetCustomAttributes(typeof(BizTalk AssemblyAttribute), false);
if (oa.Length > 0)
this._isBizTalkAssembly = true; // oa.Length = 0 here
************************************************** **********
Code Sample 2:
object[] custAtt = this._btAsembly.GetCustomAttributes(false);
// custAtt.Length = 14 on my machine
// custAtt.Length = 13 on my QA machine (The only attribute which is
// BizTalkAssembly type is missing from the list).
************************************************** **********

Of course I'm loading the exact same assembly in both machines.
Any ideas anyone?
Dec 1 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.