7
votes

I can able to build my silverlight 4.0 application in Win xp(IIS 5.1). But when i try to build the same app in Win Server 2008 R2(IIS 7), i am getting the error,

"error CS0012: The type 'System.ServiceModel.ClientBase`1' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'".

The path actually it is refereing the dll on both the machines is, "C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.ServiceModel.dll".

What may be the issue?

Thanx in advance

3
What mechanism are you using to build it on the server? msbuild? VS? what? Also: is 4.0 installed on the server? If this is on-the-fly building when run as a web app, is the web app configured to use CLR 4.0? (the default is probably 2.0) - Marc Gravell
Am using msbuild and 4.0 is installed on the server. Its not the on-the-flybuild Marc. - Mohan
and are you using msbuild from the 4.0 locations? - Marc Gravell
Marc, did u mean to ask whether the assemblies are refering from 4.0 locations? - Mohan
no, I mean: is there any chance you are running the wrong version of msbuild - Marc Gravell

3 Answers

5
votes

Make sure that under the Reference Folder of your project you see System.ServiceModel.

2
votes

This issue might happen when you move your solution from one higher level environment to another. ex: my colleague created it on VS2015 which has this dll automatically generated. then, when i tried to run it on my environment. it shows this error. because my environment does not generate such a library automatically.

Hopefully, you just have to add "System.ServiceModel.ClientBase" manually through "Add reference"

1
votes

Is one a 64bit environment and the other is a 32bit environment, I have seen cases before when an assembly decides that it will only work on certain platforms, so the "Any CPU" build option is telling it to build in the wrong platform.