I'm attempting to download metadata for a WCF service using svcutil but I'm running into issues with the /directory:<> parameter. The directory I want to save to has a space in it:

C:\Service References\Logging

so when I execute /t:metadata I receive the following error:

Error: The directory 'C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\References\Logging' could not be found. Verify that the directory exists and that you have the appropriate permissions to read it.

It looks to me like the space in "Service References" is causing the issue. From my understanding of command shell (which is very little) spaces act as delimiters for an executable. So I tried escaping the space with a carrot

Service^ References

and surrounding the path in double quotes

"C:\Service References\Logging"

but neither of those seem to be working, as the /directory: parameter doesn't recognize them as valid characters in the value. I haven't been able to find any direction in regards to this and svcutil, so I'm at a loss right now.

I could download the files to a temp folder and then move them, but I would prefer not to take that approach.

I would appreciate any direction that could be given on trying to resolve this. Thanks in advance.

-- EDIT -- this is the full command that I'm trying to run. if you try it yourself, you'll have to add you're own WCF reference as this one is on an internal ip address

svcutil /t:metadata http://dev.taskservices.noelnet.com/LoggingService/LoggingService.svc /d:C:\Service References\Logging\

有帮助吗?

解决方案

According to the documentation for svcutil

/directory: - Directory to create files in (default: current directory) (Short Form: /d)

Since the default is to use the current directory, let us change the current directory for the command.

pushd "C:\Service References\Logging\"
svcutil /t:metadata http://dev.taskservices.noelnet.com/LoggingService/LoggingService.svc
popd

If you do not need to revert back to the original directory you can just use cd "C:\Service References\Logging\".

Note, in order for this to work, svcutil must be called using its entire path or have its path listed in the PATH environment variable. This is what I mean by calling using its entire path:

cd "C:\Service References\Logging\"
"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\svcutil.exe" /t:metadata http://dev.taskservices.noelnet.com/LoggingService/LoggingService.svc
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top