security-code-scan / security-code-scan

Vulnerability Patterns Detector for C# and VB.NET
https://security-code-scan.github.io
GNU Lesser General Public License v3.0
931 stars 159 forks source link

security-scan /your/solution.sln throws up error. #275

Open misterraj7 opened 1 year ago

misterraj7 commented 1 year ago

PS C:\Users\jvraj\Downloads\New folder> dotnet tool install --global security-scan --version 5.6.7 Tool 'security-scan' is already installed. PS C:\Users\jvraj\Downloads\New folder> security-scan webgoat.net.sln

╔═╗┌─┐┌─┐┬ ┬┬─┐┬┌┬┐┬ ┬ ╔═╗┌─┐┌┬┐┌─┐ ╔═╗┌─┐┌─┐┌┐┌ ╚═╗├┤ │ │ │├┬┘│ │ └┬┘ ║ │ │ ││├┤ ╚═╗│ ├─┤│││ ╚═╝└─┘└─┘└─┘┴└─┴ ┴ ┴ ╚═╝└─┘─┴┘└─┘ ╚═╝└─┘┴ ┴┘└┘

.NET tool by Jaroslav Lobačevski v5.6.7

Loading solution 'webgoat.net.sln' Msbuild failed when processing the file 'C:\Users\jvraj\Downloads\New folder\WebGoat\WebGoat.NET.csproj' with message: The imported project "C:\Program Files\dotnet\sdk\6.0.302\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\6.0.302\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk. C:\Users\jvraj\Downloads\New folder\WebGoat\WebGoat.NET.csproj Finished loading solution 'webgoat.net.sln' PS C:\Users\jvraj\Downloads\New folder>

I am using visual studio 17.2.6

kevinneumann commented 1 year ago

I am having a similar issue. I can use the --ignore-msbuild-errors flag but that seems to just skip the project from being scanned. Looking for a better solution.

ThomasFrey commented 1 year ago

I ran into this as well. Seems like any item the solution/project that uses $(VSToolsPath) will try to go to "C:\Program Files\dotnet\sdk\6.0.302\Microsoft\VisualStudio\v17.0\" instead of the correct location.

nbelley commented 1 year ago

Any other ideas for this?

BenMakesGames commented 1 year ago

I'm also unable to run the tool, getting a similar error:

Msbuild failed when processing the file 'C:\progs\laser\src\API\API.csproj' with message: C:\Program Files\dotnet\sdk\6.0.408\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets: (144, 5): The current .NET SDK does not support targeting .NET 7.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 7.0.

I'm not sure why .NET 6 is being referenced at all; this is a .NET 7 project; we even have a global.json which requires 7.0.304 for our project. (and I have the 7.0.304 SDK installed, of course. I do also have a version of 6 installed; haven't tried uninstalling it, as it's needed for another project I work on.)

other info:

camsilver commented 11 months ago

Causing issue with Azure Pipeline as well Ran into simular issue