WCF, svcutil build proxy with /reference
I have a ClassLib call Id.API. Id.Web references this.
Within Id.API I have an Entity, MyEntity.
When I try to create the call to method SendEcho(MyEntity myentity), Id.Web project complains that it expects a param of
id.web.types.MyEntity
instead of
Id.API.MyEntity
Researching suggests to me that this is f开发者_开发知识库ixed using a reference switch on the svcutil command line.
Here is my example command line:
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\SvcUtil.exe"
http://id.web/Services/EchoService.svc?wsdl
/config:C:\Projects\Id.Web\Interface\Services\EchoService.svc.config
/reference:../bin/Id.API.dll
I get the error:
Error: Cannot load reference assembly '../bin/Id.API.dll'
Cannot load file ../bin/Id.API.dll as an Assembly. Check the FusionLogs for more Information.
Could not load file or assembly 'file:///C:\Projects\Id.Web\Interface\bin\Id.API.dll' or one of its dependencies.
This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
How can i fix this? thanks
What .NET framework version is Id.API.dll, and what .NET framework is the assembly that references it? It sounds like the Id.API.dll is built with a newer framework than the project you're trying to reference it with.
I changed SvcUtil.exe path
from C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.5.1 Tools to C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.5.1 Tools
the error is disappear.
精彩评论