tags:

views:

1581

answers:

1

Hi all, I was curious if anyone knew how to fix this: When I add a bindingExtension or bindingElementExtension to my WCF config, Visual Studio throws a schema validation warning, because the name of the extension is not in the system.serviceModel schema:

Warning 1 The element 'bindings' has invalid child element 'nmsBinding'. List of possible elements expected: 'basicHttpBinding, customBinding, msmqIntegrationBinding, netPeerTcpBinding, netMsmqBinding, netNamedPipeBinding, netTcpBinding, wsFederationHttpBinding, ws2007FederationHttpBinding, wsHttpBinding, ws2007HttpBinding, wsDualHttpBinding, mexHttpBinding, mexHttpsBinding, mexNamedPipeBinding, mexTcpBinding, webHttpBinding, netTcpContextBinding, wsHttpContextBinding, basicHttpContextBinding'.

This might be a dumb question, but is there a way to "dynamically" register these extensiions with visual studio, so that they validate? I was thinking I could drop an xsd somewhere in the visual studio configs, but I'd rather not do that if there's some other magical way.

Here is what my serviceModel config looks like:

<system.serviceModel>

    <services>
        <service name="Zed.Apache.NMS.WCF.Test.Server.TestApacheNMSService">
            <endpoint
                name="nmsServiceEndpoint"
                address="tcp://localhost:61616"
                binding="nmsBinding"
                bindingConfiguration="defaultNmsBinding" 
                contract="Zed.Apache.NMS.WCF.Test.Server.ITestApacheNMSService" />
        </service>
    </services>

    <bindings>
        <nmsBinding> <!-- VALIDATION ERROR HERE -->
            <binding name="defaultNmsBinding"
                     destination="TestApacheNMSQueue"
                     destinationType="Queue" />
        </nmsBinding>
    </bindings>

    <extensions>
        <bindingExtensions>
            <add name="nmsBinding"
                 type="Apache.NMS.WCF.NmsBindingCollection, Zed.Apache.NMS.WCF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
        </bindingExtensions>
    </extensions>

</system.serviceModel>
+1  A: 

I believe VS2008 uses the file "C:\Program Files\Microsoft Visual Studio 9.0\xml\Schemas\DotNetConfig.xsd" (with default installation) for validation of the config file. You can change this file or specify another schema under "Properties" for the config file.

However, as long as you are only receiving design time warnings, it may not be worth the trouble.

Jakob Christensen
Ok cool, thanks for the answer.
Andy White