.net 如何在没有 Visual Studio 的情况下使用 Wcf 测试客户端?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6340082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 15:38:31  来源:igfitidea点击:

How can the Wcf Test Client be used without Visual Studio?

.netvisual-studiowcf

提问by Dnana

When WcfTestClient.exe is copied to another machine by itself, runtime errors prevent you from connecting to a WCF service, for example:

当 WcfTestClient.exe 自行复制到另一台计算机时,运行时错误会阻止您连接到 WCF 服务,例如:

System.IO.FileNotFoundException: Could not load file or Assembly 'Microsoft.Build.Utilities.Core, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

System.IO.FileNotFoundException:无法加载文件或程序集“Microsoft.Build.Utilities.Core,Version=15.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。该系统找不到指定的文件。

How can this tool be used without installing Visual Studio?

如何在不安装 Visual Studio 的情况下使用此工具?

回答by TagFolks

To run WCFTestClient.exeas a standalone appplication (without install a full version of Visual Studio 2010):

WCFTestClient.exe作为独立应用程序运行(无需安装完整版 Visual Studio 2010)

  1. Create a directory in the dest.machine and copy wcftestclient.exethere (only that file).
  2. Copy Microsoft.VisualStudio.VirtualTreeGrid.dll (version 10) from file below to same directory of wcftestclient.exein the dest.machine.

    C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\v4.0_10.0.0.0__b03f5f7f11d50a3a
    
  3. You would create in your destination machine the following two registry keys:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools-x64]
    "InstallationFolder"="\"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools-x86]
    "InstallationFolder"="\"
    

    Step note:You could export them from your development machine (maybe you could find another version, but please try with v7.0A first).

  4. Then you will need copy from:

    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\svcutil.exe
    

    to your destination machine (same directory as wcftestclient.exe)

    Step note:Is important this version of svcutil.exe

  5. Run wcftestclient.exe

  1. dest.机器中创建一个目录并复制到wcftestclient.exe那里(仅该文件)
  2. 将 Microsoft.VisualStudio.VirtualTreeGrid.dll(版本 10)从下面的文件复制到机器wcftestclient.exe中的相同目录dest.

    C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\v4.0_10.0.0.0__b03f5f7f11d50a3a
    
  3. 您将在目标计算机中创建以下两个注册表项:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools-x64]
    "InstallationFolder"="\"
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools-x86]
    "InstallationFolder"="\"
    

    步骤说明:您可以从您的开发机器中导出它们(也许您可以找到其他版本,但请先尝试 v7.0A)

  4. 然后您需要从以下位置复制:

    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\svcutil.exe
    

    到您的目标机器(与 相同的目录wcftestclient.exe

    步骤说明:这个版本很重要svcutil.exe

  5. wcftestclient.exe

Final notes:You will need only two .exefiles and one .dll(wcftestclient.exe, svcutil.exe and Microsoft.VisualStudio.VirtualTreeGrid.dll)to run the application.

最后说明:您只需要两个.exe文件和一个.dll( wcftestclient.exe, svcutil.exe and Microsoft.VisualStudio.VirtualTreeGrid.dll)即可运行该应用程序。

More information

更多信息

回答by Benj

The above mentioned link doesn't work anymore. New page that contains a link: https://community.dynamics.com/crm/b/workandstudybook/archive/2014/06/03/standalone-wcftestclient.aspx

上面提到的链接不再有效。包含链接的新页面:https: //community.dynamics.com/crm/b/workandstudybook/archive/2014/06/03/standalone-wcftestclient.aspx