Multiple references to same assembly kept in project file

Uniwares_ASUniwares_AS Posts: 168
edited June 25, 2010 11:34AM in SmartAssembly 5
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
<Assembly AssemblyName="myassembly" />

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

The project file now contains the following:
<Assembly AssemblyName="myassembly" />
<Assembly AssemblyName="myassembly, Culture=neutral, PublicKeyToken=xxxxxxx" />

Works even with HintPaths set.

Comments

  • Paul.MartinPaul.Martin Posts: 83 New member
    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.
Sign In or Register to comment.