Hi @Jiayao Wu-MSFT ,
Thank you for the reply. I have tried unchecking the "Reuse Types in Referenced Assemblies" box, but it doesn't resolve the problem. I have also tried to simplify the situation as much as possible, and I am providing steps to reproduce the problem below. Again, this works if I do it in VS 2019. It also works, in VS 2022, if I use a different combination of project types. It does not work if the project hosting the WCF Service is created using the "ASP.NET Web Application (.NET Framework)" project template and the project where the proxy/client is created is created using the "WCF Service Application" project template.
Steps to reproduce Problem
------------
1. In Visual Studio 2022, create a new project using the "ASP.NET Web Application (.NET Framework)" project template with the name "TestWCF3" using .NET Framework 4.8.
2. Add a new folder to the project named "Webservices"
3. Add to this folder a new item of type "WCF Service" with name "CarService.svc"
4. Add a new class file named "Car.cs" to the project with this code:
public class Car
{
public int Id { get; set; }
public string Make { get; set; }
}
5. Modify the generated CarService interface to have only this "AllCars" method:
[ServiceContract]
public interface ICarService {
[OperationContract]
List<Car> AllCars();
}
6. Modify the CarService.cs class to implement the ICarService interface like this:
public class CarService : ICarService {
public List<Car> AllCars() {
return new List<Car>() {
new Car() {Id = 1, Name = "Ford"},
new Car() {Id = 2, Name = "Honda"}
};
}
}
7. Build the project.
8. Add a new project to the solution using the "WCF Service Application" project template with the name "TestWCF3.Workflow" using .NET Framework 4.8.
9. Right-Click on the "References" item in the new "TestWCF3.Workflow" project and select "Add Service Reference…"
10. In the "Add Service Reference" dialog, press the "Discover" button; expand the "Webservices/CarService.svc" service and select "CarService"; change the Namespace to "CarClient"; and the press the OK button.
11. The files shown here are generated, but the "References.cs" file is empty. It should contain the required proxy/client code. I received no error messages at all.
10/31/2022 12:23 PM 391 CarService.disco
10/31/2022 12:23 PM 2,949 CarService.wsdl
10/31/2022 12:23 PM 846 CarService.xsd
10/31/2022 12:23 PM 2,488 CarService1.xsd
10/31/2022 12:23 PM 794 CarService2.xsd
10/31/2022 12:23 PM 1,461 configuration.svcinfo
10/31/2022 12:23 PM 19,810 configuration91.svcinfo
10/31/2022 12:23 PM 651 endpointConfigurationNameResolver.svcinfo
10/31/2022 12:23 PM 0 Reference.cs
10/31/2022 12:23 PM 2,440 Reference.svcmap
10 File(s) 31,830 bytes