Please forgive me if I am wrong:

VB6 had conditional compilation similar to the #if #end if in C/C++/C#.
Did that make it into VB.NET and if it did, can you use it in the
identical way to the example given by Stefan?  I didn't notice in the
posts any refernce to using the feature in the VB.NET version.

Or is it truly a compiler problem in that it simply does not remove
unused references?

Doug



-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Stefan
Holdermans
Sent: Monday, July 14, 2003 01:42 PM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Add Declarative Reference To Assembly


Mathhew,

It seems you're right... The VB.NET compiler does include unused
references. I'm afraid the only option you have here is invoking the
compiler from the command line and omit the unneeded references.

Regards,

Stefan


>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf 
>Of Matthew Bertram
>Sent: Monday, July 14, 2003 9:06 PM
>To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Subject: RE: Add Declarative Reference To Assembly
>
>
>Stefan,
>
>Touché! I humbly acknowledge the vast superiority of C# on
>this feature. :-) Unfortunately, the VB compiler (which I am 
>constrained to use) does not share the ability to remove 
>unused assembly references. Is there any way (or possibly an 
>add-in) that would allow VB to behave the same way?
>
>Thanks!
>
>Matthew
>
>-----Original Message-----
>From: Stefan Holdermans [mailto:[EMAIL PROTECTED]
>Sent: Saturday, July 12, 2003 4:33 AM
>To: Matthew Bertram; [EMAIL PROTECTED]
>Subject: RE: Add Declaritive Reference To Assembly
>
>Matthew,
>
>When the code in your Release configuration does not use any
>of the types from a particular assembly A, then the resulting 
>assembly will not include any references to A.
>
>For instance: I've a library project that makes uses of the
>types in the assembly nunit.framework *only* in Debug configuration:
>
>  #if DEBUG
>
>  [TestFixture]
>  public class My Tester { /* ... */ }
>
>  #endif
>
>When I compile defining the DEBUG symbol, the resulting
>assembly contains a reference to nunit.framework in its manifest:
>
>  .assembly extern nunit.framework
>  {
>    .publickeytoken = (96 D0 9A 1E B7 F4 4A 77 )
>    .ver 2:0:6:0
>  }
>
>But when I compile without defining the DEBUG symbol, the
>reference does not end up in the manifest.
>
>HTH,
>
>Stefan
>
>
>>-----Original Message-----
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED] On Behalf
>Of Matthew
>>Sent: Friday, July 11, 2003 4:53 PM
>>To: [EMAIL PROTECTED]
>>Subject: Add Declaritive Reference To Assembly
>>
>>
>>Hi,
>>
>>I'm trying to include a reference to a particular assembly when in 
>>debug mode, but not when in release mode. Here is an example:
>>
>>#If DEBUG Then
>>
>>'Add declaritive reference to assembly
>>
>>#End If
>>
>>Is there a way to do this (like the snippet above) without having to 
>>manually add/remove the assembly in VStudio, or run command line 
>>builds?
>>
>>Thanks!
>>
>>Matthew
>>
>

Reply via email to