I am building a siple CRUD App using sql server and Dapper orm with .net 7.
And throws the error "System.IO.FileNotFoundException: 'Could not load file or assembly 'Dapper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'"
Aravind GovindarajPosted Feb 15, 2023, 3:14 PM
could you kindly check, if Is it installed properly with all its dependencies
Tuhin PaulPosted Feb 15, 2023, 6:30 AM
From the error message I can suggest that your application is unable to locate the Dapper assembly.
Try checking these things one by one:
1. Ensure that the Dapper package is installed: You can use NuGet Package Manager in Visual Studio to install the Dapper package. Right-click on your project in Solution Explorer, select "Manage NuGet Packages," and then search for "Dapper." If the package is not installed, click the "Install" button to install it.
2. Check your project references: Ensure that your project is referencing the correct version of the Dapper assembly. You can check this by right-clicking on your project in Solution Explorer, selecting "References," and then looking for the Dapper assembly in the list. If it's not there, you can add it by clicking "Add Reference" and then selecting the Dapper assembly from the list.
3. Check the version of .NET: Ensure that your application is targeting the correct version of .NET that is compatible with the version of Dapper you are using. You can check this by right-clicking on your project in Solution Explorer, selecting "Properties," and then looking under the "Target Framework" section. If the version of .NET is not compatible with the version of Dapper, you will need to update your application to use a compatible version.
4. Check the output folder: Ensure that the Dapper assembly is copied to the output folder of your project. You can do this by right-clicking on the Dapper assembly in Solution Explorer, selecting "Properties," and then setting the "Copy to Output Directory" property to "Copy Always" or "Copy if Newer." This will ensure that the assembly is copied to the output folder when you build your project.
5. Try cleaning and rebuilding your solution: Sometimes, cleaning your solution and rebuilding it can resolve issues with missing assemblies. You can do this by right-clicking on your solution in Solution Explorer and selecting "Clean Solution," and then right-clicking again and selecting "Rebuild Solution."
See if it is of any help. Let me know.
Naimish MakwanaPosted Feb 15, 2023, 6:26 AM
Please refer below link
https://stackoverflow.com/a/48982522/3054222
https://stackoverflow.com/questions/59215005/visual-studio-2019-error-could-not-load-file-or-assembly-or-one-of-its-depende