Svcutil.exe for .NET 4.0?

前端 未结 7 1676
闹比i
闹比i 2021-01-31 03:24

I was trying to use svcutil.exe to generate proxy classes for a service but when I use the /reference option to reference an assembly that is built for .NET 4.0 I g

相关标签:
7条回答
  • 2021-01-31 03:32

    Why not rebuild as .NET 3.5 to generate the classes? I suspect the types you're generating classes for don't rely on any .NET 4.0 functionality. The cs files won't care what version the DLL was built for so you can use them in a 4.0 project just fine.

    0 讨论(0)
  • 2021-01-31 03:34

    The latest version of the SDK for .Net 4.0 is available at

    http://msdn.microsoft.com/en-us/windows/bb980924.aspx

    svcutil.exe which resides in v7.1/bin has version 3.0.4506.2152.

    svcutil.exe which resides in v7.1/bin/NETFX 4.0 Tools has version 4.0.30319.1.

    0 讨论(0)
  • 2021-01-31 03:35

    Answering my own question. The new version of svcutil will probably come with v7.1 of the Windows SDK that is released in mid-June.

    0 讨论(0)
  • 2021-01-31 03:37

    Update: Newest version of util is not v7.0 as per:

    Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools

    SvcUtil.exe v8.0A is now available after installing Visual Studio 2012 (VS 2012)

    "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\SvcUtil.exe"

    What you really want is the full definition for turning a WSDL file into a service client:

    /n:*,MyCompany.Services.Client /out:IServiceInterface.cs ServiceDefinition.wsdl.xml

    Where service definition.wsdl is obviously the ?wsdl response from any old soap endpoint.

    Minions and Trolls remember! Everything is now Async so look for and take advantage of the new Async support generated by v8.0 of SVCUtil.exe

    0 讨论(0)
  • 2021-01-31 03:39

    I'm having the same problem.

    Microsoft says that you can only use .Net 4 DLLs with the new SvcUtil that comes wit the latest version of .Net (http://msdn.microsoft.com/en-us/library/aa347733.aspx) but that version seems to be the one you are mentioning above. It won't access .Net 4 DLLs as references at all.

    0 讨论(0)
  • 2021-01-31 03:42

    I had the same issue. If your project is set to use the .NET 4.0 Framework, you must choose the right version of SvcUtil.exe, or it will throw an error: "Could not load..."

    • If you look in "Microsoft SDKs\Windows\v6.0A\Bin", you will see that the version of that exe is "3.0.4506.2152".
    • The version of SvcUtil.exe in "Microsoft SDKs\Windows\v7.0A\Bin" is exactly the same, so it threw me for a loop as well.

    However, there is another version of SvcUtil.exe located in "Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools" which is version "4.0.30319.1", and if you use it, everything should work.

    0 讨论(0)
提交回复
热议问题