Multiple references to same assembly kept in project file

.NET obfuscator and automated error reporting

Multiple references to same assembly kept in project file

Postby Uniwares_AS » Fri Jun 25, 2010 2:46 pm

When I do have an incomplete assembly reference in the {sa}proj file and load the project into the GUI app, it will be expanded into the full reference and added to the project file but the other reference is kept.

I've had already project files where more than two references to the same assembly ended up in the sa project file.

Don't know if that affects the build process, but sure cant be the correct thing.

To repro simply add a assembly reference like

Code: Select all
<Assembly AssemblyName="myassembly" />

now load the project file into the gui, build and save.

The project file now contains the following:

Code: Select all
<Assembly AssemblyName="myassembly" />
<Assembly AssemblyName="myassembly, Culture=neutral, PublicKeyToken=xxxxxxx" />

Works even with HintPaths set.
Posts: 132
Joined: Thu Oct 11, 2007 2:29 pm

Postby Paul.Martin » Fri Jun 25, 2010 3:34 pm

It is one of the fun things targeting the .NET Framework, the assembly resolution. In its project files SmartAssembly uses semi-full name resolution so an assembly called "myassembly" does not equal one called "myassembly, Culture=neutral, PublicKeyToken=xxxxxxx".

One big thing that should be noted is that SmartAssembly will always resolve the referenced assemblies from the main assembly itself. It only uses the listing in the project file to determine what settings to apply.

So having two entries in the project file about the "same" (one full, one partially named) assembly will not make any difference to the build process, however SmartAssembly will only apply the protection settings listed in the full named section.

The fact that the other entry is kept does have the nice benefit that if you have dynamic references (or even want to use the same project file for multiple assemblies via the command line... although we don't recommend this) you can add protection entries for all the assemblies you are likely to apply protection to and they will be protected when SmartAssembly finds them needed.

Generally we recommend using the GUI to edit the project file, although there are lots of times when we understand editing the file by hand is the easiest way. I suppose at some point we should give the file grammar, but I think the only gotcha is that the AssemblyName should be the .NET full name without version number.
Posts: 83
Joined: Wed Feb 03, 2010 10:20 am
Location: Cambridgeshire

Return to SmartAssembly 5

Who is online

Users browsing this forum: No registered users and 0 guests