Answered by:
Proxy generated code cause conflicts

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?
ThanksThursday, 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- Marked as answer by Amit Sharma [MSFT]Microsoft employee Friday, February 13, 2009 6:54 PM
- Unmarked as answer by Sivi-san Thursday, February 19, 2009 12:45 PM
- Marked as answer by Amit Sharma [MSFT]Microsoft employee Wednesday, April 29, 2009 9:14 PM
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- Proposed as answer by Youssef Moussaoui - MSFT Wednesday, March 4, 2009 12:20 AM
- Marked as answer by Youssef Moussaoui - MSFT Tuesday, March 10, 2009 10:38 PM
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/weblog2Thursday, 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 namespaceThursday, 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- Marked as answer by Amit Sharma [MSFT]Microsoft employee Friday, February 13, 2009 6:54 PM
- Unmarked as answer by Sivi-san Thursday, February 19, 2009 12:45 PM
- Marked as answer by Amit Sharma [MSFT]Microsoft employee Wednesday, April 29, 2009 9:14 PM
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?
ThanksThursday, 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.
AmitTuesday, 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- Proposed as answer by Youssef Moussaoui - MSFT Wednesday, March 4, 2009 12:20 AM
- Marked as answer by Youssef Moussaoui - MSFT Tuesday, March 10, 2009 10:38 PM
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