'error : The imported project was not found. Confirm that the expression in the Import declaration is correct, and that the file exists on disk
BUILD ERROR: When I load the solution file in Visual Studio, it says file failed to load. The full error says:
C:\path\to\project.csproj : error : The imported project "C:\path\to\target.targets" was not found. Confirm that the expression in the Import declaration is correct, and that the file exists on disk
I checked and the targets file exists in that path
I am using Visual Studio 2019. If I try to build from the command line, it fails as well. Does anyone know what the problem could be? Right now I cannot run let alone build my project
Solution 1:[1]
Actually, it is quite strange and should not be an issue since you just quote the import
method and make sure the path of the file is correct.
Not sure whether your project or vs has broken.
Please try to the following steps to troubleshoot the issue:
First of All, make sure that the targets file on the folder path C:\path\to
is the same as target.targets
and make sure it exists.
1) close VS delete .vs
hidden folder under the solution folder, bin
and obj
folder.
2) open VS IDE, click Menu Extensions-->Manage Extensions and then disable any installed extensions to check whether it is caused by them.
3) reset all vs settings under Tools-->Import and Export Settings-->Reset All Settings and you can make a backup before you do it.
4) repair vs or update vs to the latest version.
Also, you can use type devenv /safemode under Developer Command Prompt for VS2019 to start VS and then test your project.
Besides, you can create a new project and do the same step to import that targets file to check whether the issue occurs in the new one.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |