Hi, Check your Web(ShopOnline.Web) project references and add the Model project in the references. Maybe you are missing to add model project (ShopOnline.Models) in ShopOnline.Web project.
CS0246: The type or namespace name "ProductDto" could not be found(are u missing a using directive or an assembly reference?)
hey anyone give me the solution of this issue https://github.com/GavinLonDigital/ShopOnlineSolution/issues/1
3 answers
Sort by: Newest
-
-
Zhi Lv - MSFT 32,016 Reputation points Microsoft Vendor
2022-06-27T06:09:31.877+00:00 Hi @DEBASIS PAUL (Zhýralý Pāvils) #BlackLivesMatter ,
CS0246: The type or namespace name "ProductDto" could not be found(are u missing a using directive or an assembly reference?)
If you check the Yotube video or check the source code, you can see that in the solution, there have three projects: ShopOnline.Api, ShopOnline.Models and ShopOnline.Web.
The ProductDto class was in the ShopOnline.Models project, and in the ShopOnline.Api and ShopOnline.Web project, they will add the ShopOnline.Models project reference.
For example, in the ShopOnline.Web project, right click the Dependencies option => click the Add Project Reference... => in the popup window select the ShopOnline.Models project => Finally, click the Ok button. Then, in the ShopOnline.Web project, you can add the ShopOnline.Models project reference:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.Best regards,
Dillion -
SurferOnWww 1,911 Reputation points
2022-06-25T00:51:49.52+00:00 I guess that you copied the source code written by somebody else and the definition of ProductDto class is included somewhere else. If so please find the source code that include the definition of ProductDto class.
I understand that the Dto stands for Data Transfer Object as described in the following Microsoft document:
Create Data Transfer Objects (DTOs)
https://learn.microsoft.com/en-us/aspnet/web-api/overview/data/using-web-api-with-entity-framework/part-5It is likely defined in a separate .cs file.