views:

49

answers:

2

Hello everyone,

I am using Windows Server 2008 Enterprise + .Net 3.5 + VSTS 2008 + C# to develop a console application. The application runs fine on my developer desktop. But when I run the same application on another machine (Windows Server 2008 Enterprise as well, but no VSTS 2008 installed), there is error says assembly Microsoft.Expression.Encoder can not be found. For security and policy reasons, I can not install VSTS 2008 or SDK on the machine to use tools like gacutil to debug (so any quick method to find whether the assembly is correctly installed or not?).

My question is, where should Microsoft.Expression.Encoder be? In GAC or somewhere else? I am not sure how my program looks for Microsoft.Expression.Encoder.

BTW: my console application is not strong signed, and I think Microsoft.Expression.Encoder should be strong signed, correct? If so, where should Microsoft.Expression.Encoder be found -- in GAC or in local folder (e.g. the same folder as the console applicaton)?

thanks in advance, George

+1  A: 

That assembly relates to Silverlight and WPF application. If you are developing console app, you shouldnt need to refer to it. Try check your assembly reference in the project and remove unnecessary references that you dont need and try it again.

Fadrian Sudaman
Hi, my application needs to use Expression Encoder SDK functionality, why I should remove reference to it? Another question is if I reference to this assembly, how (e.g. where to find and in what order to find) runtime finds the assembly?
George2
From your question it wasnt clear that you actually use and need the encoder assembly hence I made this suggestion. Hans post below has a link to it, does that work?
Fadrian Sudaman
The link is about where to download Encoder SDK. But my question is if I reference to this assembly, how (e.g. where to find and in what order to find) runtime finds the assembly? It is general case about how a non-strong signed console application finds a strong signed reference assembly? Any ideas?
George2
@George the Encoder strongly signed assembly is the same like all others standard assemblies in the framework such as System.dll, mscorlib.dll. Your assembly contains manifest which hold metadata about assembly references . If it is strongly signed, it will look at the GAC first, otherwise your local folder. See this post http://stackoverflow.com/questions/954257/the-order-of-assemblies-being-loaded
Fadrian Sudaman
(1) "If it is strongly signed" -- "it" you mean the referenced Encoder assembly in my scenario, correct? (2) In general scenario, if referenced assembly is strong signed assembly (e.g. Encoder assembly), and my console application which refers the strong name assembly is not strong signed, is that ok?
George2
(1) correct. (2) Its ok. Thats why I gave you the example above. A clear example, if you create a Hello World console app project, the project automatically reference system.dll and mscorlib.dll and they are both strongly signed and without doing anything you can execute the hello world program. That tells it all.
Fadrian Sudaman
Two more questions. (1) whether debug and release version assembly DLL is the same? For example, in my development environment, my console application refers to debug version of foo.dll, and if I replace (replace means overwrite foo.dll physical file) the debug version foo.dll to release version foo.dll, is it still work? (2) in similar scenario, I am not sure if in my development environment, my console application refers to 32-bit version of foo.dll, and if I replace (replace means overwrite foo.dll physical file) the 32-bit version foo.dll to 64-bit version foo.dll, is it still work?
George2
(1) Generally yes, if it matches the assembly ref info in the manifest and there is no dependencies different. (2) NO. You cant mix and match. Your app have to be compiled and run on the same target. Loading 64bit dll in application build targetting 32bit will fail in loading due to reading of the binary table of the assembly file, vice versa.
Fadrian Sudaman
Thanks, question answered!
George2
+1  A: 

You have a dependency on a component that won't be available by default, you have to install it. Expression Encoder comes in two versions. The free version is available for download from here. Do note the restrictions, it doesn't support smooth streaming or encode to H.264. Follow the link in the download page to the retail edition if this is a problem. Just installing Blend on the machine would probably solve it too, but that would surely be a "security" problem as well.

Hans Passant
(1) Do you have any ideas that if I reference to this assembly, how (e.g. where to find and in what order to find) runtime finds the assembly? (2) I think this assembly is strong signed assembly, and my console application is not strong signed (and reference to this assembly), is that ok?
George2
It isn't a problem with finding the assembly, the problem is that it isn't on the machine. Nothing to do with strong names or signing, .NET assemblies have strong names and are signed. This won't go anywhere until you actually install Expression Encoder on that machine.
Hans Passant
Thank you for your answer.
George2