0

嗨,我在现有的 web 服务中编写了新功能。我在重建并复制到我使用 powershell 的特定位置时正在复制代理文件,但它不起作用。我收到以下错误。

**The term 'wsdl.exe' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was in
cluded, verify that the path is correct and try again.
At C:\[path edited for security]\RebuildProxy.ps1:30 char:9
+ wsdl.exe <<<<  /fields "/l:CS" "/n:$namespace" "/out:$outCSFile" "/urlkey:Tes
tEndpoint" "$wsdlUrl";
+ CategoryInfo          : ObjectNotFound: (wsdl.exe:String) [], CommandNot 
FoundException
+ FullyQualifiedErrorId : CommandNotFoundException**

重建后,我收到消息文件已在源编辑器之外修改[生成的代理文件已经存在于该位置],请您帮我解决这个发布在 powershell 代码下面的问题

param (
    [string]$webServiceProjFile = $(throw "webServiceProjFile paramter is required." ),
    [string]$serviceFile = $(throw "serviceFile parameter is required."),
    [string]$outCSFile = $(throw "outCSFile paramter is required." )
)

if (! [IO.File]::Exists($webServiceProjFile))
{
    throw "$webServiceProjFile note found.";
}

if (! [IO.File]::Exists($outCSFile))
{
    throw "$outCSFile note found.";
}

# read the project file into an XML document.
$projectFileXml = [xml] (Get-Content $webServiceProjFile );

# access the configured IIS URL
$serviceWsdlUrl = [string]::Concat($projectFileXml.Project.ProjectExtensions.VisualStudio.FlavorProperties.WebProjectProperties.IISUrl.Trim(), '/', $serviceFile);

$namespace = "";
# Read the namespace for the proxy from the proxy C# file
Get-Content $outCSFile | ForEach-Object { if ($_ -match "^\s*namespace\s+([A-Za-z._]+)\s+{\s*$") { $namespace = $matches[1] }};

$wsdlUrl = [string]::Concat("$serviceWsdlUrl", '?wsdl');

# Regenerate the proxy using WSDL.exe
wsdl.exe /fields "/l:CS" "/n:$namespace" "/out:$outCSFile" "/urlkey:TestEndpoint" "$wsdlUrl";

# Update the generated C# file so the proxy class interits from WSE2 base class.
(Get-Content $outCSFile) |
ForEach-Object { $_ -replace "\s+\:\s+System\.Web\.Services\.Protocols\.SoapHttpClientProtocol", " : Microsoft.Web.Services2.WebServicesClientProtocol" } |
Set-Content $outCSFile ;

$projectDirectory = [IO.Path]::GetDirectoryName($outCSFile);


$appConfigFilePath = [IO.Path]::Combine($projectDirectory, "App.config");

(Get-Content $appConfigFilePath) |
ForEach-Object { $_ -replace '<add\s+key="TestEndpoint"\s+value="[^"]*"\s+/>', "<add key=""TestEndpoint"" value=""$serviceWsdlUrl"" />" } |
Set-Content $appConfigFilePath ;
4

1 回答 1

0

WSDL.EXE 不在路径中。在我的电脑上,它带有视觉工作室。

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64\wsdl.exe
于 2012-07-04T11:59:51.570 回答