We use the PowerShell script to run the wsdl.exe tool for us (or in your case svcutil.exe). The script ends with a service and pulls out a new wsdl and redirects the proxy. You can use to get to the PS. The only trick is to set the name order correctly, but there is an option for wsdl.exe for this.
<Target Name="UpdateWebReferences">
<Exec WorkingDirectory="$(SolutionRoot)"
Command="$(PS) -Noninteractive -Command $(SolutionRoot)\tools\PowerShell\Compile-Wsdl.ps1 -ukf $(ConfigFilePath)"
Condition=" Exists('$(ConfigFilePath)') And Exists('$(SolutionRoot)\tools\PowerShell\Compile-Wsdl.ps1') " />
The above goes on to build your team. The powershell function meat looks like this:
$projectFile = [xml]( Get-Content $projectFilePath )
if ( $projectFile -and $WSDL_LANGUAGE -ne "VB")
{
$ns = $projectFile.Project.PropertyGroup[ 0 ].RootNamespace
}
else
{
$ns = $NAMESPACE_PREFIX
}
foreach( $webRefDir in Get-ChildItem $dir.FullName )
{
$webRefName = $webRefDir.Name
if ( [System.String]::IsNullOrEmpty( $ns ) )
{
$namespace = $webRefName
}
else
{
$namespace = $( "{0}.{1}" -f $ns, $webRefName )
}
Write-Host $( "Compiling Web Reference: {0} using Namespace: {1}..." -f $webRefName, $namespace )
$outputPath = $( "{0}\{1}" -f $webRefDir.FullName,$REFERENCE_FILE )
$xpath = "/configuration/appSettings/add[@key='{0}']" -f $webRefName
if ( $URL_KEY_FILE )
{
$xml = [xml](Get-Content $URL_KEY_FILE)
$url = $xml.SelectSingleNode( $xpath )
if ( $url )
{
$urlOrPath = $url.Value
}
else
{
Write-Warning $( "Could not find key {0} in {1}..." -f $webRefName, $URL_KEY_FILE )
}
}
else
{
$urlOrPath = $( Get-ChildItem $webRefDir.FullName -r -filter "*.wsdl" ).FullName
}
if ( $urlOrPath )
{
wsdl /nologo /language:$WSDL_LANGUAGE /n:$namespace /o:$outputPath /urlkey:$webRefName $urlOrPath
}
Write-Host "....................................................."
}
All that is required for this must be installed in the Web Links folder. It moves through each directory and creates the correct namespace. The script is long, but I would like to send it by email.
source
share