473,770 Members | 6,091 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 2995
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
1274
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
2695
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
15956
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
2182
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
1608
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
5114
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
5684
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
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
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
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
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
9873
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...
0
8891
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5313
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
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.