Introduction

There are times when you need to use the WCF test client in places where Visual Studio is not installed, namely a production server or a non-developer machine at times. There is a post on StackOverflow that addresses this exact concern: http://stackoverflow.com/questions/6340082/downloading-wcf-test-client-without-vs However as time moves on the answers are becoming a little outdated; and if you work at an organization like I do where the network security is above average, bordering insane, then you cannot just download anything you want as it is blocked. I cannot download files from google drive or onedrive. Therefore I had to recreate a portable WCF test client for myself yesterday following the instructions that are provided on the stack overflow post and msdn forum. I just want to document what I did so I can re-reference it later if needed.

Before we get started

The whole point here is to produce a transportable copy of the WCF test client so that you don’t need Visual Studio to be installed where you are trying to perform your WCF test. There is just one ironic caveat here – you absolutely need a machine that has Visual Studio installed in order to actually produce a transportable copy of the WCF test client. Therefore if you don’t have a machine where this can be done, then you are doomed to download a copy of the WCF test client – hopefully that is an option for you. Even the strongest network security cannot thwart the following efforts at times (depends on how insane your company’s security is):

  1. Temporarily hosting files on a web server
  2. FTP in some cases
  3. Downloading files to your phone and moving them over using any method you can think of
  4. Email if the files are small enough
  5. IM clients
  6. USB drives
  7. Portable hard drives

I am not advocating doing anything illegal or something that will violate your company’s workplace policies, but at the same time some of these restrictions are so suffocating we, as developers, cannot get our jobs done. Not being able to simply download the WCF Test Client from the web is a good example of this – therefore the work around is I have to create it myself.

Your version of Visual Studio dictates what you need to do

The following table is a transformation of information from this post here: https://social.msdn.microsoft.com/Forums/vstudio/en-US/c3c7221c-c06f-4364-887a-fb20f22877be/wcf-test-client-problem I am giving credit where credit is due to Jakub Berezanski who aggregated this very useful information. Thank you to goes to him.

Visual StudioVersionRequired FilesBatch fileRequired registry key
201211.0C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\WcfTestClient.exeXCOPY /Y “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\WcfTestClient.exe” “.\”HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86
  C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\v4.0_11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VirtualTreeGrid.dllXCOPY /Y “C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\v4.0_11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VirtualTreeGrid.dll” “.\” 
  C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\SvcUtil.exeXCOPY /Y “C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\SvcUtil.exe” “.\” 
  C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\SvcConfigEditor*.*XCOPY /Y “C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\SvcConfigEditor*.*” “.\” 
201312.0C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\WcfTestClient.exeXCOPY /Y “C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\WcfTestClient.exe” “.\” 
  C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\v4.0_12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VirtualTreeGrid.dllXCOPY /Y “C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\v4.0_12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VirtualTreeGrid.dll” “.\”HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1A\WinSDK-NetFx40Tools-x86
  C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\SvcUtil.exeXCOPY /Y “C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\SvcUtil.exe” “.\” 
  C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\SvcConfigEditor*.*XCOPY /Y “C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\SvcConfigEditor*.*” “.\” 
201514.0C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\WcfTestClient.exeXCOPY /Y “C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\WcfTestClient.exe” “.\” 
  C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\v4.0_14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VirtualTreeGrid.dllXCOPY /Y “C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\v4.0_14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VirtualTreeGrid.dll” “.\”HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools-x86
  C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcUtil.exeXCOPY /Y “C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcUtil.exe” “.\” 
  C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcConfigEditor*.*XCOPY /Y “C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcConfigEditor*.*” “.\” 
15 Preview15.0C:\Program Files (x86)\Microsoft Visual Studio 15.0\Common7\IDE\WcfTestClient.exeXCOPY /Y “C:\Program Files (x86)\Microsoft Visual Studio 15.0\Common7\IDE\WcfTestClient.exe” “.\”HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools-x86
  C:\Program Files (x86)\Microsoft Visual Studio 15.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.VirtualTreeGrid.dllXCOPY /Y “C:\Program Files (x86)\Microsoft Visual Studio 15.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.VirtualTreeGrid.dll” “.\” 
  C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcUtil.exeXCOPY /Y “C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcUtil.exe” “.\” 
  C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcConfigEditor*.*XCOPY /Y “C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcConfigEditor*.*” “.\” 

How to do this, using a Visual Studio 2015 (v14.0) installation

I wrote a batch file that will copy down the files for me and in my opinion the registry keys are the most complicated part. Therefore the steps are as follows:

  1. Copy down the required files according to the above table
  2. Export the required registry keys
    1. I recommend just exporting the x86 and x64 versions of the registry keys. I highly doubt having both will brick your machine because something has to be looking for those keys in order to actually flip out. Therefore this is pretty harmless. If you are paranoid then just stick to your box’s architecture.
    2. I strongly recommend including the “InstallationFolder” key and setting it to literally what you see here: “\\” – when I didn’t include this I got a run time error. In Jakub’s post, he says you don’t need it, this is where we disagree. Whatever – this is all by trial and error.
  3. Copy all of the files you copied from your development machine to the target machine.
  4. Copy over the registry export file and just double click on it in order to add those keys
  5. Run the WcfTestClient.exe and you should be good to go

Supporting example

Here is an example of the batch file to execute. Take notice that it will copy the files to the current directory. You can change this if you want. Copy this as is into a text file and give it a *.bat extension. Double click to run.

XCOPY /Y "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\WcfTestClient.exe" ".\"
XCOPY /Y "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\v4.0_14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VirtualTreeGrid.dll" ".\"
XCOPY /Y "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcUtil.exe" ".\"
XCOPY /Y "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\SvcConfigEditor*.*" ".\"

PAUSE

Here is an example of the exported registry values for Visual Studio 2015 (v14.0). Copy this as is into a text file and give it a *.reg extension. Double click to import the keys into the target machine.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\NETFXSDK\4.6]
"InstallationFolder"="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\"
"ProductVersion"="4.6.00081"
"ProductName"="Microsoft .NET Framework 4.6 SDK"
"KitsInstallationFolder"="\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools]
"ProductVersion"="4.6.00081"
"ComponentName"="Microsoft .NET Framework 4.6 SDK"
"InstallationFolder"="\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools-x64]
"ProductVersion"="4.6.00081"
"ComponentName"="Microsoft .NET Framework 4.6 SDK"
"InstallationFolder"="\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools-x86]
"ProductVersion"="4.6.00081"
"ComponentName"="Microsoft .NET Framework 4.6 SDK"
"InstallationFolder"="\\"
  • If it really bothers you to add all of those keys, feel free to not include them in your file.
  • Take notice that the KitsInstallationFolder and InstallationFolder keys are set to “\\”, this is the only edit I had to make. When you export them, these are actually filled in – you don’t want that on your target machine because VisualStudio is not installed, therefore it is directing the program to the current directory that the executable is running in.

Downloads

If you are able to download files freely, then you can get this data here:

01/28/2020 Update – Visual Studio 2017

It’s been a long time since I updated this article – I just haven’t had the time it would take to figure out what was required. Here is my updated answer for Visual Studio 2017. When I actually get around to installing Visual Studio 2019 I will update again.

The problem this time around is a bogus error that would keep popping up stating that:

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.
File name: ‘Microsoft.Build.Utilities.Core, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’

This is a bogus problem because on further inspection you will find that the configuration for the “WcfTestClient.exe.config” is clearly trying to point to a relative location of the “Microsoft.Build.Utilities.Core.dll”. This took me a bit to figure out.

Solution

You have to modify the config’s “codeBase” node from this:

<codeBase version="15.1.0.0" href="..\..\MSBuild\15.0\Bin\Microsoft.Build.Utilities.Core.dll" />

to read like this

<codeBase version="15.1.0.0" href="Microsoft.Build.Utilities.Core.dll" />

Which means that the DLL it needs is localized.

First thing’s first – you need to copy all of the required files to a local destination – so modify this batch file as needed:

ECHO OFF

set "dest=C:\DumpFolder\"

set "source=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin"

XCOPY /Y "%source%\Microsoft.Build.*.dll" "%dest%"

XCOPY /Y "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.VirtualTreeGrid.dll" "%dest%"

REM This depends on which DotNet you have installed - changed the version accordingly
set "source=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools"

XCOPY /Y "%source%\SvcConfigEditor.*" "%dest%"
XCOPY /Y "%source%\SvcUtil.exe" "%dest%"

set "source=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE"

XCOPY /Y "%source%\WcfTestClient.*" "%dest%"

ECHO Manually update the WcfTestClient.exe.config's codeBase node - change the value of the "href" attribute to "Microsoft.Build.Utilities.Core.dll"

PAUSE

I haven’t found a need to import any registry keys this time around. After copying the files locally you will want to follow the instructions above for updating the configuration.

I tested this on a machine that doesn’t have any development tools on it and it worked. I can’t guarantee anything though.

Be aware that:

  • I am probably copying more files than required but that’s because I am not sure what all the dependencies of “Microsoft.Build.Utilities.Core.dll” are.
  • The version of Dot Net Framework you have installed will affect the above batch file.

7 Replies to “Using the WCF Test Client without Visual Studio”

  1. It seems it is not working for Visual Studio 2017
    requires “Microsoft.Build.Utilities.Core, Version=15.0.0.0”

    1. I am going to try to address this for you. I am currently only vacation so I actually have time to look at this. Sorry for the late reply.

    2. I’m really sorry for how long it took for me to get back to you. I have updated the article. This was particularly hard to figure out. I tested my solution and it worked for me. Let me know if this works for you.

    1. I totally forgot about this. I will see if I can take care of it this week. I have some WCF services I can test with at work on Monday.

    2. I’m really sorry for how long it took for me to get back to you. I have updated the article. This was particularly hard to figure out. I tested my solution and it worked for me. Let me know if this works for you.

Leave a Reply

Your email address will not be published. Required fields are marked *