
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I'm trying to run following powerShell script for scan my solution(.NET Core 2.0) with Fortify:
$SolutionFilePath = "C:\Repositories\MyProject" $SolutionFileName = "MyProjectToTest" $SSCFPRFileName = "MyProjectToTest.fpr" $BuildIdName = "MyProjectToTest" $path = "D:\Fortify" If(!(test-path $path)) { New-Item -ItemType Directory -Force -Path $path } cd \ cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin" sourceanalyzer -b $BuildIdName -clean sourceanalyzer -b $BuildIdName msbuild "$SolutionFilePath\$SolutionFileName.sln" sourceanalyzer -b $BuildIdName -scan -f "$path\$SSCFPRFileName" exit 0
Every things works fine in my local machine.
But when I tried to run it in the server as a build step in TeamCity (TeamCity Enterprise 2018.2.1 (build 61078)) I got an error:
Microsoft (R) Build Engine version 16.0.461+g6ff56ef63c for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved. MSBUILD : error MSB1021: Cannot create an instance of the logger. Could not load file or assembly 'Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Switch: C:\Program Files\HPE_Security\Fortify_SCA_and_Apps_17.20\Core\lib\FortifyMSBuildTouchless.dll
I'm using same version of Fortify in my local and the server (Fortify Static Code Analyzer 17.20.0183 (using JRE 1.8.0_144) ).
In both server and local machine I installed Build Tools for Visual Studio 2019 and .Net core SDK.
I tried with different version of MsBuild(14, 15, 16) and dotnet.exe and devenv.exe and I installed PowerShell Core. I got the same error.
I also could run the script in the same server for .NETFramework projects successfully, the only change is I used different path:
cd "C:\Windows\Microsoft.NET\Framework64\v4.0.30319"
It seems Fortify 17.20 does not support the .NETCore 2.X, When I add the
-dotnet-core-version 2.0
I got an error (in both local and server):
[error]: Invalid parameter 2.0 for command line argument -dotnet-core-version
but with 1.X is ok, so how is possible the same version of fortify works fine in local but not in the server?
What is the problem with .NETCore projects? any idea?
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
After some searching I found this one and it works fine for me:
$SolutionFilePath = "C:\Repositories\MyProject" $SolutionFileName = "MyProjectToTest" $SSCFPRFileName = "MyProjectToTest.fpr" $BuildIdName = "MyProjectToTest" $path = "D:\Fortify" If(!(test-path $path)) { New-Item -ItemType Directory -Force -Path $path } cd \ cd "$SolutionFilePath" sourceanalyzer -b $BuildIdName -clean sourceanalyzer -b $BuildIdName -libdirs **/* **/* sourceanalyzer -b $BuildIdName -scan -f "$path\$SSCFPRFileName" exit 0
No msbuild no other commands just navigate to solution folder and run it without any extra command.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
After some searching I found this one and it works fine for me:
$SolutionFilePath = "C:\Repositories\MyProject" $SolutionFileName = "MyProjectToTest" $SSCFPRFileName = "MyProjectToTest.fpr" $BuildIdName = "MyProjectToTest" $path = "D:\Fortify" If(!(test-path $path)) { New-Item -ItemType Directory -Force -Path $path } cd \ cd "$SolutionFilePath" sourceanalyzer -b $BuildIdName -clean sourceanalyzer -b $BuildIdName -libdirs **/* **/* sourceanalyzer -b $BuildIdName -scan -f "$path\$SSCFPRFileName" exit 0
No msbuild no other commands just navigate to solution folder and run it without any extra command.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I have a dotnet core 2.1 and a dotnet standard 2.0 projects.
I'm using Azure DevOps (TFS) extention "Micro Focus Fortify" https://marketplace.visualstudio.com/items?itemName=fortifyvsts.hpe-security-fortify-vsts
The build task "Fortify Static Code Analyser Assessment" tries to run such a command which is generated internally and i cannot change it