'dotnet list package fails with error: Imported project "...\Microsoft.VisualStudio.Tools.Office.targets" not found
We have a VSTO-based addin and we want to monitor the NuGet packages for security vulnerabilities.
When executing the command dotnet list package --vulnerable, we receive the error below:
error: The imported project "C:\Program Files\dotnet\sdk\6.0.101\Microsoft\VisualStudio\v17.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\6.0.101\Microsoft\VisualStudio\v17.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" is correct, and that the file exists on disk.
We can certainly write a script that temporarily removes that import and executes the scanning.
We've also tried to trick the tool - we've copied the .targets file to the instructed folder, but this didn't work.
Is there, maybe, already a solution in the existing toolchain?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
