locked
Proxy generated code cause conflicts RRS feed

  • Question

  • Hello,

    After using svcutil to generate the proxy code I got the following warnings:
    Warning 1 The type 'Details' in 'C:\Proxy.cs' conflicts with the imported type 'Details' in 'c:\ClassLibrary1\bin\Debug\ClassLibrary1.dll'. Using the type defined in 'C:\Proxy.cs'. 

    How can I solve it?
    Can I rename one oth namespaces?

    Thanks
    Thursday, February 12, 2009 12:45 PM

Answers

  • you will have to generate the proxy in a seperate namespace to avoid this conflict. Use the /n switch in svcutil

    svcutil /namespace:*,test.MyNs http://xxx/service/myservice.svc


    Amit
    Thursday, February 12, 2009 3:50 PM
  • Using /namespace should solve the issue.

    But also, if the Details that gets generated in the proxy and the Details that you use in your assembly should actually be the same type, then consider using the:

    svcutil /r switch

    /r allows you to reference an assembly so types that exist in that assembly will be referenced and not re-generated.

    So using svcutil /r:MyApp.exe would result in Details not being regenerated if it already existed in MyApp.exe
    Wednesday, March 4, 2009 12:19 AM

All replies

  • Both types are in the same namespace? or do you not s[pecify the namespace when you use it so the commpiler doesn;t know which one to use?
    Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
    Thursday, February 12, 2009 3:13 PM
  • Hi Richard,

    I'll try to explain it more detailed.
    The IService (Contract) is using functions that have arguments with 'Details' type.
    When I'm creating the proxy file, I'm doing it in mainApplication project.
    Inside mainApplication project I'm using 'Details' objects for other needs.
    That's what creates the conflict.

    For example if I have inside mainApplication the object : Details x = new Details()
    The compiler dont know if it belongs to the original definition of details or to new definition that is created in the proxy.
    In addition, the original definition of 'Details' is sitting under "Installer" namespace and the proxy redefine 'Details' under the same namespace

    Thursday, February 12, 2009 3:34 PM
  • you will have to generate the proxy in a seperate namespace to avoid this conflict. Use the /n switch in svcutil

    svcutil /namespace:*,test.MyNs http://xxx/service/myservice.svc


    Amit
    Thursday, February 12, 2009 3:50 PM
  • Hi,

    The problem wasn't solved.
    There is still a conflict because the proxy file defines 'Details' class again:

    public partial class Details : object, System.Runtime.Serialization.IExtensibleDataObject

    I taught of separating the wcf and rest of the project to separate solutions.
    Is there any other solution for this problem?


    Thanks


    Thursday, February 19, 2009 11:45 AM
  • isn't the Details object in a different namespace now that you have used the /namespace switch in svcuti?
    can you please post both the namespaces for the Details object.


    Amit
    Tuesday, February 24, 2009 7:26 AM
  • Using /namespace should solve the issue.

    But also, if the Details that gets generated in the proxy and the Details that you use in your assembly should actually be the same type, then consider using the:

    svcutil /r switch

    /r allows you to reference an assembly so types that exist in that assembly will be referenced and not re-generated.

    So using svcutil /r:MyApp.exe would result in Details not being regenerated if it already existed in MyApp.exe
    Wednesday, March 4, 2009 12:19 AM
  • Did you set the startup object to the xxxx.Program? It is in the Application tab.
    Tuesday, July 30, 2013 3:15 AM