473,652 Members | 3,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically compiled assemblies and strong naming

If I am using the CSharpCodeProvi der 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?
Nov 16 '05 #1
2 2176
On Wed, 2 Feb 2005 16:47:02 -0800, Thomas W. Brown wrote:
If I am using the CSharpCodeProvi der 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?


There should not be any problem AFAIK as long as you do this dynamically
(as in post compilation, and not a reference, which surely is the case with
you, is it?), but if you want to do this,I think you can use

_compileUnit.As semblyCustomAtt ributes.Add(new CodeAttributeDe claration( ..)

to set

[assembly: AssemblyKeyFile ("xyz.snk")]
[assembly: AssemblyKeyName ("abc")]

Cheers,
Ranjan
--
http://dotnetjunkies.com/weblog/dotnut
Nov 16 '05 #2
"ra************ *@gmail.com" wrote:
On Wed, 2 Feb 2005 16:47:02 -0800, Thomas W. Brown wrote:
If I am using the CSharpCodeProvi der 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?
There should not be any problem AFAIK as long as you do this dynamically
(as in post compilation, and not a reference, which surely is the case with
you, is it?),


Hmmm... actually I have a couple of different scenarios so I'm not sure.

1. From a strongly named assembly I need to take some runtime generated C#
code and compile to a DLL assembly on disk.

2. From the same strongly named assembly I need to generate some more C#
code, dynamically compile to an in-memory assembly *and* addref the assembly
I created in (1).

3. Again, from the original strongly named assembly I need to instantiate
objects in the assembly created in (2) and invoke their methods.

I'm just wondering whether I'm going to be running into problems with the
strong naming since it seems a strongly named assembly can only "reference"
other strongly named assemblies. It is unclear whether this extends to
dynamically compiled assemblies.
but if you want to do this,I think you can use

_compileUnit.As semblyCustomAtt ributes.Add(new CodeAttributeDe claration( ..)

to set

[assembly: AssemblyKeyFile ("xyz.snk")]
[assembly: AssemblyKeyName ("abc")]
Thanks, that might come in handy!!

Cheers,
Ranjan
--
http://dotnetjunkies.com/weblog/dotnut


-- TB

Nov 16 '05 #3

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

Similar topics

2
1899
by: Kyle Blaney | last post by:
What happens when a strongly-named assembly is not in the global assembly cache (GAC) but is installed in two application's bin directories (with each copy being identical in every way - the exact same version, public key, culture information, etc.)? I understand the benefits of deploying shared assemblies with each application instead of using the GAC but is increased memory usage a disadvantage of this approach? For example, suppose...
0
276
by: Ice | last post by:
All - I read out on MSDN that "If your main assembly uses strong naming, satellite assemblies must be signed with the same private key as the main assembly." Well if you allow the regeneration of resources at client sites, this forces you to have to ship your strong name also. Anyone know any workarounds for this.
3
2975
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:
1
1455
by: Jason | last post by:
I've been experiementing with Assembly.Load..CreateInstance and strong naming the assemblies. This has given me a few questions, 1. Does the version number matter? I've found that its the public key token that controls whether the assembly is the right one. Changing the version number did not have any affect.
5
2053
by: Chua Wen Ching | last post by:
Hi all, Basically right now, i am interested to learn how to break strong names in ..net assemblies. I had researched a lot and found a blog that mention how to hack strong name assemblies. http://blogs.msdn.com/shawnfa/archive/2004/08/20/218049.aspx " In order to enable post-build modifications, you need to either:
2
1181
by: adrian.snell | last post by:
I have a strong names signed assembly which contains a user control. I wish to embed this user control in an html file that will display in a browser. This control references and makes use of the System.IO.Ports and System.Net.Sockets libraries, which means permissions must be granted for this to work correctly. To do this, in Control Panel>Administrative Tools>.NET Framework 2.0 Configuration I have added a code group under machine for...
0
1117
by: John Liu | last post by:
Recently I had to do some really nasty work (I consider any IL work nasty) to get a set of (not strong named) 3rd party assemblies to compile with our solution (which is strong named). DISCLAIMER: We've notified the 3rd party and a strong named version will be provided in the next release, but in the mean time for our internal development and testing to continue we've had to do some hacking. I do not recommend this technique with...
2
5172
by: loretta.stokes | last post by:
I was wondering if anyone else has experienced this problem. On certain machines we get the standard error when starting the service manually (or on reboot): "Error 1503: The service did not respond to the start or control request in a timely fashion" and "Timeout(3000 milliseconds) waiting for the <MyServiceNameto connect" I added code to the constructor of the service to write a message to
2
5106
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.
0
8703
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
8467
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
8589
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
5619
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4145
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
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
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.