2016-11-22 123 views
4

我創建了一個默認的.Net Core 1.0.1類庫,並更改了project.json中的buildOptions以包含debugType:「Full」。我使用集成的VS 2015 Fortify Scan使用16.11,我得到下面的錯誤。我應該如何掃描dotnet核心以避免此問題?如何使用Fortify Scan 16.11掃描dotnet核心項目.Json

Project'src \ providesFileInPackage \ providesFileInPackage.xproj'未配置爲輸出完整的調試信息。 SCA分析需要完整的調試符號。你想忽略項目並繼續? (項目屬性 - >建設 - > 「高級」 按鈕 - >調試信息 - > 「全」 OR 項目屬性 - >編譯 - >高級選項 - >調試信息 - > 「完全」 VB)

我的項目json看起來像

{ 
    "version": "1.0.0-*", 
    "dependencies": { 
    "NETStandard.Library": "1.6.0" 
    }, 
    "frameworks": { 
    "netstandard1.6": { 
     "imports": "dnxcore50" 
    } 
    }, 
    "buildOptions": { 
    "define": [ "DEBUG" ], 
    "debugType": "full" 
    } 
} 
+2

很想知道這個決議,因爲我面臨的確切問題。 – AspiringTFSGuru

回答

0

我有同樣的問題。它指責xproj文件,而不是project.json所以我嘗試添加

<DebugType>full</DebugType> 

PropertyGroup內,但無濟於事。

最後我找到了一個解決方法,通過在命令行中運行Fortify的:現在,但我

<?xml version="1.0" encoding="utf-8"?> 
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 

    <PropertyGroup> 
    <MySolution>MyApplication.sln</MySolution> 
    <Configuration Condition=" $(Configuration) == '' ">Debug</Configuration> 
    <CommonMSBuildProperties>BuildingSolutionFileName=true</CommonMSBuildProperties> 
    <RunHPFortify Condition=" '$(RunHPFortify)' == '' ">false</RunHPFortify> 
    <HPFortifyPath Condition=" '$(HPFortifyPath)' == '' ">$(ProgramW6432)\HP_Fortify\HP_Fortify_SCA_and_Apps_4.40\</HPFortifyPath> 
    <FortifyMSBuildTasks>$(HPFortifyPath)Core\lib\FortifyMSBuildTasks.dll</FortifyMSBuildTasks> 
    </PropertyGroup> 

    <ItemGroup> 
    <Projects Include="$(MySolution)"> 
     <AdditionalProperties>Platform=Any CPU</AdditionalProperties> 
    </Projects> 
    </ItemGroup> 

    <Target Name="Clean"> 
    <MSBuild Projects="@(Projects)" Targets="Clean" Properties="$(CommonMSBuildProperties)" /> 
    </Target> 

    <Target Name="Build"> 
    <MSBuild Projects="@(Projects)" Targets="Build" Properties="$(CommonMSBuildProperties)" 
      StopOnFirstFailure="true" /> 
    </Target> 

    <Target Name="Rebuild"> 
    <MSBuild Projects="@(Projects)" Targets="Rebuild" Properties="$(CommonMSBuildProperties)" 
      StopOnFirstFailure="true" /> 
    </Target> 

    <UsingTask TaskName="Fortify.CleanTask" AssemblyFile="$(FortifyMSBuildTasks)" /> 
    <UsingTask TaskName="Fortify.TranslateTask" AssemblyFile="$(FortifyMSBuildTasks)" /> 
    <UsingTask TaskName="Fortify.ScanTask" AssemblyFile="$(FortifyMSBuildTasks)" /> 

    <Target Name="FortifyBuild" AfterTargets="Build;Rebuild" Condition="$(RunHPFortify)"> 
    <PropertyGroup> 
     <BuildID>MyApplication</BuildID> 
     <HPFortifyLogsDir>..\HPFortifyLogs\</HPFortifyLogsDir> 
     <PackagesDir>$(MSBuildProjectDirectory)\packages\</PackagesDir> 
     <OutDir>$(MSBuildProjectDirectory)\MyApplication\bin\$(Configuration)\net452\win7-x64\</OutDir> 
     <SCATargetBinary>$(OutDir)MyApplication.exe</SCATargetBinary> 
     <FPRFilePath>$(HPFortifyLogsDir)MyApplication.fpr</FPRFilePath> 
     <SSCUploadToken Condition=" '$(SSCUploadToken)' == '' ">1cfe9977-905c-4da4-bb57-97e3dcc33099</SSCUploadToken> 
    </PropertyGroup> 

    <ItemGroup> 
     <TranslateTaskReferences Include="$(OutDir)" /> 
    </ItemGroup> 

    <CleanTask BuildID="$(BuildID)" /> 

    <TranslateTask 
     BuildID="$(BuildID)" 
     VSVersion="14.0" 
     JVMSettings="-Xmx1000M" 
     BinariesFolder="$(SCATargetBinary)" 
     References="@(TranslateTaskReferences)" 
     LogFile="$(HPFortifyLogsDir)sca_translate_task.log"> 
    </TranslateTask> 

    <ScanTask 
     BuildID="$(BuildID)" 
     JVMSettings="-Xmx1000M" 
     LogFile="$(HPFortifyLogsDir)scan_task.log" 
     Output="$(FPRFilePath)" /> 

    </Target> 

</Project> 

我不究比右側多:

msbuild MyApplicationSca.proj /p:Configuration=Release /t:Rebuild /m 

MyApplicationSca.proj看起來是這樣的希望這能讓我們更接近答案。

+0

Hello @KevinG,%BUILD_CONFIG%是什麼,如何獲取MSBuild.GlobalRelay.targets?你能幫助解決這個解決方案的樣本項目嗎? – yayadavid

+1

@yayadavid我意識到我的示例文件中有無用的東西。我已經編輯了我的答案來解決您的問題,但我現在無法創建示例項目 - 我正在記錄以便稍後改進我的答案 – KevinG