473,725 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to dynamically load strong name assemblies

Hi All,

We have an automated build and test environment using NAnt and Nunit.
Some of our assemblies are being strong named by modifying the
AssemblyInfo.cs and having csc compile it. Some of these strong named
assemblies are being dynamically loaded into the runtime. We store the
metadata information about the strong named assemblies in a config
file.

Metadata in the config file looks like this:

MyAssembly.Name .Here,Version=1 .0.x.x, Culture=neutral ,
PublicKeyToken= xxxxxxx

Here is the problem. When conducting a build, the Version of the
strong named assemblies increment. The config file has not been
updated to reflect this change (Because in theory we shouldn't have to
change the config file all the time). Therefore, when the Nunit tests
run and try to load the assemblies to test in runtime it'll fail
becuase the version info is incorrect.

I thought about this and thought of delay-signing the assemblies after
the Nunit tests complete, but then when it is deployed the problem
still persists.

Does anyone have any ideas on loading strong names assemblies
dynamically storing the metadata in a config file in an automated build
environment?
I know this is a long read and thanks to all.

md

Jul 21 '05 #1
3 2992
It's not difficult to find out those attributes and update a config file -
is that what you're asking? AssemblyName.Ge tAssemblyName(p ath) followed by
calls to Version and GetPublicKeyTok en() will get you those attributes.
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

<la******@yahoo .com> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.com.. .
Hi All,

We have an automated build and test environment using NAnt and Nunit.
Some of our assemblies are being strong named by modifying the
AssemblyInfo.cs and having csc compile it. Some of these strong named
assemblies are being dynamically loaded into the runtime. We store the
metadata information about the strong named assemblies in a config
file.

Metadata in the config file looks like this:

MyAssembly.Name .Here,Version=1 .0.x.x, Culture=neutral ,
PublicKeyToken= xxxxxxx

Here is the problem. When conducting a build, the Version of the
strong named assemblies increment. The config file has not been
updated to reflect this change (Because in theory we shouldn't have to
change the config file all the time). Therefore, when the Nunit tests
run and try to load the assemblies to test in runtime it'll fail
becuase the version info is incorrect.

I thought about this and thought of delay-signing the assemblies after
the Nunit tests complete, but then when it is deployed the problem
still persists.

Does anyone have any ideas on loading strong names assemblies
dynamically storing the metadata in a config file in an automated build
environment?
I know this is a long read and thanks to all.

md

Jul 21 '05 #2
That's very useful info. However, I am trying determine if there are
any other approaches to this issue, other than changing the config file
during the build?

Anyone?

md

Jul 21 '05 #3
The real solution is to stop changing your assembly version every time
you build! I say this with an exclamation point because it is a very
common mistake (aided by Microsoft's mistake of making AssemblyVersion
increment by default in AssemblyInfo.cs ).

From "Applied .Microsoft .NET Framework Programming" - Jeffrey Richter,
regarding the AssemblyVersion attribute:

"When starting to develop an assembly, you should set the major, minor,
build, and revision numbers and shouldn't change them until you're ready
to begin work on the next deployable version of your assembly."

The AssemblyVersion should not change for new internal builds. Consider
it analogous to changing the assembly file name with every build:
Project1.dll, build again to produce Project2.dll, then Project3.dll.
You wouldn't want to do that, would you? That is exactly what you are
doing if you increment AssemblyVersion with every build.
Joshua Flanagan
http://flimflan.com/blog
la******@yahoo. com wrote:
Hi All,

We have an automated build and test environment using NAnt and Nunit.
Some of our assemblies are being strong named by modifying the
AssemblyInfo.cs and having csc compile it. Some of these strong named
assemblies are being dynamically loaded into the runtime. We store the
metadata information about the strong named assemblies in a config
file.

Metadata in the config file looks like this:

MyAssembly.Name .Here,Version=1 .0.x.x, Culture=neutral ,
PublicKeyToken= xxxxxxx

Here is the problem. When conducting a build, the Version of the
strong named assemblies increment. The config file has not been
updated to reflect this change (Because in theory we shouldn't have to
change the config file all the time). Therefore, when the Nunit tests
run and try to load the assemblies to test in runtime it'll fail
becuase the version info is incorrect.

I thought about this and thought of delay-signing the assemblies after
the Nunit tests complete, but then when it is deployed the problem
still persists.

Does anyone have any ideas on loading strong names assemblies
dynamically storing the metadata in a config file in an automated build
environment?
I know this is a long read and thanks to all.

md

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1272
by: kfkyle | last post by:
We are currently developing our build process for an ASP.NET application. This application will consist of about 8 assemblies in total. Even though these assemblies will be deployed in a private application directory, we are would like to apply strong names to them. If possible, we would like to avoid the need to rebuild any given Assembly if code changes have not occurred. However, a problem I see with this approach has to do with the...
10
2690
by: Tony Jones | last post by:
Can anyone think of a reason why a 3rd party vendor writing .NET components would NOT strong name their assemblies? What harm does adding a strong-name to assembly present - I would think none whatsoever. Strong-naming the assembly should benefit the end user just in case he/she wants to reference the assembly in another strong-named assembly or add it to the GAC. If you were a third-party vendor, would you strong-name your...
1
15952
by: Greg Patrick | last post by:
My problem: I load an some assemblies (strong named) from a byte array using Assembly.Load(byte). They load fine. But one one of them is actually accessed, it's referenced assemblies can't be found on disk and I get a TargetInvocationExeption. For example, let's say I have a C# win forms application called Prog. Prog.exe uses Assembly.Load(byte) to load two C# class library assemblies,
2
2181
by: Thomas W. Brown | last post by:
If I am using the CSharpCodeProvider to dynamically compile an in-memory assembly from some C# source, do I need to worry about signing this assembly if I'm doing the compilation, instantiation, and invocation of a dynamic object from a strongly named assembly? If so, how do you strongly name a dynamic, in-memory assembly?
7
3044
by: Ollie Riches | last post by:
I am trying to dynamically load an assembly that has a reference to 'Interop.WMEncoderLib.dll' which is a PIA to the windows media player DRM components. When I run the code from a console application it works perfectly fine, but when the assembly containing the reference is load from a windows service an exception is thrown with the following message: "File or assembly name Interop.WMEncoderLib, or one of its dependencies, was not...
3
1605
by: Mark Keogh | last post by:
Hi, Why is everything some confusng when MS are involved ;-) Anyway, I have my excel export routines working fine, now when I try to build them into my assembly, which has a strong name, I get the Unable to emit assembly: Referenced assembly 'Interop.VBIDE' does not have a strong name message and everything stops. Now I searched the NET and all I can find is
3
544
by: lanky_tx | last post by:
Hi All, We have an automated build and test environment using NAnt and Nunit. Some of our assemblies are being strong named by modifying the AssemblyInfo.cs and having csc compile it. Some of these strong named assemblies are being dynamically loaded into the runtime. We store the metadata information about the strong named assemblies in a config file. Metadata in the config file looks like this:
2
5112
by: Smithers | last post by:
I have a Windows Forms application that implements a plug-in architecture whereby required assemblies are identified and loaded dynamically. Here are the relevant classes: A = application = Windows Forms class B = a singleton hosted within A. B is responsible for dynamically loading classes X, Y, and Z.
6
5683
by: raylopez99 | last post by:
Anybody use Strong Name Signing? I think this is used by default for Resource files, which is one reason perhaps I can't get my resource files to work (somehow the public key is messed up, perhaps since I've installed so many versions of Visual Studio) RL http://msdn.microsoft.com/en-us/library/h4fa028b.aspx Deployment in Visual Studio
0
8749
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9400
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9103
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6700
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4779
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2154
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.