Red Gate forums :: View topic - Multiple references to same assembly kept in project file
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 5
SmartAssembly 5 forum

Multiple references to same assembly kept in project file

Search in SmartAssembly 5 forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
Uniwares_AS



Joined: 11 Oct 2007
Posts: 132

PostPosted: Fri Jun 25, 2010 3:46 pm    Post subject: Multiple references to same assembly kept in project file Reply with quote

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:
<Assembly AssemblyName="myassembly" />


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

The project file now contains the following:

Code:

<Assembly AssemblyName="myassembly" />
<Assembly AssemblyName="myassembly, Culture=neutral, PublicKeyToken=xxxxxxx" />


Works even with HintPaths set.
Back to top
View user's profile Send private message MSN Messenger
Paul.Martin



Joined: 03 Feb 2010
Posts: 83
Location: Cambridgeshire

PostPosted: Fri Jun 25, 2010 4:34 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group