pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

在構建代理上運行代碼分析 (FxCop > 10) 而不安裝

Running Code Analysis (FxCop gt; 10) on build agent without installing Visual Studio(在構建代理上運行代碼分析 (FxCop 10) 而不安裝 Visual Studio)
本文介紹了在構建代理上運行代碼分析 (FxCop > 10) 而不安裝 Visual Studio的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

在 FxCop 10 之后,Microsoft 停止為 FxCop 提供單獨的安裝程序.官方目前只能在安裝 Visual Studio 2013/2015/2017 后運行代碼分析(FxCop 12.0/14.0/15.0).但是,我們堅持不要在構建代理上安裝 Visual Studio(安裝需要與我們在開發人員計算機上獲得的內容保持同步等).

After FxCop 10 Microsoft stopped shipping a separate installer for FxCop. Officially one can currently only run code analysis (FxCop 12.0 / 14.0 / 15.0) after installing Visual Studio 2013 / 2015 / 2017. However, we are adamant about not installing Visual Studio on the build agents (the installation needs then to be kept in-sync with what we have got on the developer computers etc.).

那么我將如何讓 FxCop 12.0/14.0/15.0 在構建代理上工作,最好不安裝任何其他東西?不過,我會接受將一些二進制文件和 msbuild 文件添加到源代碼控制中.否則:有沒有辦法只使用 Visual Studio 2013/2015/2017 安裝程序安裝 FxCop 的東西?

So how would i go about getting FxCop 12.0 / 14.0 / 15.0 to work on a build agent, preferrably without installing anything else? I would accept adding a few binaries and msbuild files to source control, though. Otherwise: Is there a way to only install the FxCop stuff using Visual Studio 2013 / 2015 / 2017 installer?

注意:我們使用 Teamcity 作為構建服務器.

Note: we are using Teamcity as build server.

由于特定環境和 FxCop 版本有多個有效答案,我冒昧地將它們鏈接到此處以便于訪問:

As there are multiple valid answers for specific environments and FxCop versions, I've taken the liberty of linking them here for easier access:

  • FxCop 15.0 (Visual Studio 2017)
  • FxCop 14.0 (Visual Studio 2015)
  • FxCop 12.0 (Visual Studio 2013)
  • SonarQube

推薦答案

在不安裝 Visual Studio 2017 的情況下運行 FxCop 15.0

先決條件:

  • MSBuild 15.0 --> 安裝 Microsoft Build Tools 2017,您可能還想查看此處
  • Visual C++ Redistributable for Visual Studio 2017 x86或這里 帶有 C++ 的 Visual Studio 2017.---- 注意:總是需要 x86 版本,根據構建,可能還需要 x64 redist.如果它丟失,則錯誤消息可能很神秘,例如 System.IO.FileNotFoundException: 無法加載文件或程序集 'Microsoft.VisualStudio.CodeAnalysis.Interop.dll' 或其依賴項之一.找不到指定的模塊.).除了安裝整個 redist,您還可以單獨復制必要的 DLL,但此時我不知道需要哪些.找出確切缺失的部分非常棘手且耗時.
  • MSBuild 15.0 --> Install Microsoft Build Tools 2017, you might also want to see here
  • Visual C++ Redistributable for Visual Studio 2017 x86 or here OR Visual Studio 2017 with C++. ---- Note: the x86 version is always required, depending on the build x64 redist may be required as well. If it is missing the error message can be cryptic, for example System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.CodeAnalysis.Interop.dll' or one of its dependencies. The specified module could not be found.). Instead of installing the entire redist you could also copy the necessary DLLs separately, but at this point i don't know which are needed. It's quite tricky and time consuming to find out which ones are exactly missing.

取決于您要構建的內容:

Depending on what you want to build:

  • 適當的 Windows SDK,例如 Windows 10 SDK
  • 適當的 .net SDK/目標(.NET Framework 4.6 SDK 包含在 Windows 10 SDK 中)

這些是我必須添加到源代碼管理的文件:(請注意這可能違反某些許可協議)

These are the files that i had to add to source control: (Please consider that this might violate some license agreements)

(source control)	oolsFxCop15
│
├[Engines]
│   │
│   ├IntrospectionAnalysisEngine.dll
│   └PhoenixAnalysisEngine.dll
├[Msbuild]
│   │
│   ├fxcoptask.dll
│   ├Microsoft.CodeAnalysis.Targets
│   ├Microsoft.VisualStudio.CodeAnalysis.dll
│   └Microsoft.VisualStudio.CodeAnalysis.Sdk.dll
├[Repository]
│   │
│   ├[Compatibility]
│   │   │
│   │   ├Desktop2.0.xml
│   │   ├Desktop2.0SP1.xml
│   │   ├Desktop2.0SP2.xml
│   │   ├Desktop3.0.xml
│   │   ├Desktop3.0SP1.xml
│   │   ├Desktop3.0SP2.xml
│   │   ├Desktop3.5.xml
│   │   └Desktop3.5SP1.xml
│   └system32.bin
├[Rules]
│   │
│   ├DataflowRules.dll
│   ├DesignRules.dll
│   ├GlobalizationRules.dll
│   ├InteroperabilityRules.dll
│   ├MaintainabilityRules.dll
│   ├MobilityRules.dll
│   ├NamingRules.dll
│   ├PerformanceRules.dll
│   ├PortabilityRules.dll
│   ├ReliabilityRules.dll
│   ├SecurityRules.dll
│   ├SecurityTransparencyRules.dll
│   └UsageRules.dll
├[x64]
│   │
│   └msdia140.dll (1349 KB)
├[Xml]
│   │
│   ├CodeAnalysisReport.xsl
│   ├FxCopReport.xsl
│   └VSConsoleOutput.xsl
├Architecture-msil.dll
├CodeAnalysis.dll
├CustomDictionary.xml
├FxCopCmd.exe
├FxCopCmd.exe.config
├FxCopCommon.dll
├FxCopSdk.dll
├Microsoft.Cci.dll
├Microsoft.VisualStudio.CodeAnalysis.Common.dll
├Microsoft.VisualStudio.CodeAnalysis.DataflowModels.dll
├Microsoft.VisualStudio.CodeAnalysis.dll
├Microsoft.VisualStudio.CodeAnalysis.Interop.dll
├Microsoft.VisualStudio.CodeAnalysis.Phoenix.dll
├Microsoft.VisualStudio.CodeAnalysis.Phoenix.xml
├msdia140.dll (1057 KB)
├mssp7en.dll
├mssp7en.lex
├phx.dll
└Runtime-vccrt-win-msil.dll

復制如下:

  • 整個 FxCop 安裝文件夾內容來自

  • entire FxCop installation folder contents from

%programfiles(x86)%Microsoft Visual Studio2017 **在此處插入版本** Team ToolsStatic Analysis ToolsFxCop

來自 Visual Studio 2017 C++ redist(或您的 Visual Studio 2017 安裝,如果您已安裝 VC++ 工作負載:%ProgramFiles(x86)%Microsoft Visual Studio2017\VCRedistMSVC14.12.25810) 或任何其他地方:(另請參閱法律信息)復制 msdia140 x86 和 x64 (我的版本是 14.12.25810.0) 到:

from Visual Studio 2017 C++ redist (or your Visual Studio 2017 Installation, if you've got VC++ workload installed: %ProgramFiles(x86)%Microsoft Visual Studio2017\VCRedistMSVC14.12.25810) or any other place: (also see legal information) copy msdia140 x86 and x64 (mine have the version 14.12.25810.0) to:

msdia140.dll (1.12 MiB)

msdia140.dll (1.12 MiB)

amd64msdia140.dll (1.42 MiB)

amd64msdia140.dll (1.42 MiB)

所有文件從 %programfiles(x86)%\Microsoft Visual Studio2017 **INSERT EDITION HERE** MSBuildMicrosoftVisualStudiov15.0CodeAnalysis

Msbuildfxcoptask.dll

Msbuildfxcoptask.dll

MsbuildMicrosoft.CodeAnalysis.Targets

MsbuildMicrosoft.CodeAnalysis.Targets

MsbuildMicrosoft.VisualStudio.CodeAnalysis.dll

MsbuildMicrosoft.VisualStudio.CodeAnalysis.dll

MsbuildMicrosoft.VisualStudio.CodeAnalysis.Sdk.dll

MsbuildMicrosoft.VisualStudio.CodeAnalysis.Sdk.dll

另外我將項目msbuild文件(*.csproj)調整如下:

Additionally i adjusted the project msbuild file (*.csproj) as follows:

<!-- Microsoft.CSharp.targets import is contained in csproj by default. This just goes to show the sequence -->
<Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets"/>

<!-- now this must be added -->
<Import Project="$(ProjectBuildScriptDir)Custom.CodeAnalysis.targets"/>

這就是我們的 Custom.CodeAnalysis.targets 包含的內容:

And this is what our Custom.CodeAnalysis.targets contains:

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

    <!-- Code analysis settings. -->
    <PropertyGroup>
        <!-- this must reference the path where you copied the FxCop stuff to -->
        <FxCopDir>..FxCop15</FxCopDir> 
        <CodeAnalysisCulture>en-US</CodeAnalysisCulture>
        <CodeAnalysisRuleSet>$(SolutionDir)FxCop.ruleset</CodeAnalysisRuleSet>
        <!-- you can and should use another condition here. Otherwise code analysis will be run on every build in VS as well. -->
        <!-- in my build setup i do something like Condition=IsRunningOnTeamCity => true -->
        <RunCodeAnalysis>true</RunCodeAnalysis> 
        <CodeAnalysisTreatWarningsAsErrors Condition="'$(IsRunningOnTeamCity)' != 'true'">true</CodeAnalysisTreatWarningsAsErrors>
    </PropertyGroup>

    <Import Project="$(FxCopDir)MsbuildMicrosoft.CodeAnalysis.Targets" />

    <Target Name="CodeAnalysisLogHeader" BeforeTargets="RunCodeAnalysis" Condition="$(RunCodeAnalysis) == 'true' OR $(RunCodeAnalysisOnce) == 'true'">
        <Message Text="Text, Executing Code Analysis (FxCop) on $(MsBuildProjectName)" Importance="High" />
    </Target>

</Project>

Visual Studio 路徑注意事項:

Visual Studio 安裝路徑取決于版本.它包括專業版和企業版.AFAIR 社區版有不同的路徑,但也不支持 FxCop.歡迎指正:-)

Notes for Visual Studio Paths:

The path to the visual studio installation is edition dependent. It includes Professional and Enterprise. AFAIR the community edition has a different path, but also does not support FxCop. Corrections welcome :-)

這篇關于在構建代理上運行代碼分析 (FxCop > 10) 而不安裝 Visual Studio的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Is there a way to know if someone has bookmarked your website?(有沒有辦法知道是否有人為您的網站添加了書簽?)
Use of Different .Net Languages?(使用不同的 .Net 語言?)
Determining an #39;active#39; user count of an ASP.NET site(確定 ASP.NET 站點的“活動用戶數)
Best way to keep track of current online users(跟蹤當前在線用戶的最佳方式)
Recommend an Open Source .NET Statistics Library(推薦一個開源的.NET統計庫)
Create a summary description of a schedule given a list of shifts(給定輪班列表,創建時間表的摘要描述)
主站蜘蛛池模板: 颚式破碎机,圆锥破碎机,制砂机-新乡市德诚机电制造有限公司 | 美名宝起名网-在线宝宝、公司、起名平台 | FFU_空气初效|中效|高效过滤器_空调过滤网-广州梓净净化设备有限公司 | 除尘器布袋骨架,除尘器滤袋,除尘器骨架,电磁脉冲阀膜片,卸灰阀,螺旋输送机-泊头市天润环保机械设备有限公司 | 双吸泵,双吸泵厂家,OS双吸泵-山东博二泵业有限公司 | 除湿机|工业除湿机|抽湿器|大型地下室车间仓库吊顶防爆除湿机|抽湿烘干房|新风除湿机|调温/降温除湿机|恒温恒湿机|加湿机-杭州川田电器有限公司 | 快速门厂家-快速卷帘门-工业快速门-硬质快速门-西朗门业 | 防潮防水通风密闭门源头实力厂家 - 北京酷思帝克门窗 | 巨野月嫂-家政公司-巨野县红墙安康母婴护理中心 | 镀锌方管,无缝方管,伸缩套管,方矩管_山东重鑫致胜金属制品有限公司 | 压力控制器,差压控制器,温度控制器,防爆压力控制器,防爆温度控制器,防爆差压控制器-常州天利智能控制股份有限公司 | 福建自考_福建自学考试网 | 软文发布-新闻发布推广平台-代写文章-网络广告营销-自助发稿公司媒介星 | 钢格板|镀锌钢格板|热镀锌钢格板|格栅板|钢格板|钢格栅板|热浸锌钢格板|平台钢格板|镀锌钢格栅板|热镀锌钢格栅板|平台钢格栅板|不锈钢钢格栅板 - 专业钢格板厂家 | 浙江工业冷却塔-菱电冷却塔厂家 - 浙江菱电冷却设备有限公司 | 办公室家具公司_办公家具品牌厂家_森拉堡办公家具【官网】 | 高温高压釜(氢化反应釜)百科| 照相馆预约系统,微信公众号摄影门店系统,影楼管理软件-盟百网络 | 合肥办公室装修 - 合肥工装公司 - 天思装饰 | 高低温万能试验机_拉力试验机_拉伸试验机-馥勒仪器科技(上海)有限公司 | 高清视频编码器,4K音视频编解码器,直播编码器,流媒体服务器,深圳海威视讯技术有限公司 | 水压力传感器_数字压力传感器|佛山一众传感仪器有限公司|首页 | 工装定制/做厂家/公司_工装订做/制价格/费用-北京圣达信工装 | 深圳标识制作公司-标识标牌厂家-深圳广告标识制作-玟璟广告-深圳市玟璟广告有限公司 | 贵州成人高考网_贵州成考网| 防火卷帘门价格-聊城一维工贸特级防火卷帘门厂家▲ | 深圳激光打标机_激光打标机_激光焊接机_激光切割机_同体激光打标机-深圳市创想激光科技有限公司 深圳快餐店设计-餐饮设计公司-餐饮空间品牌全案设计-深圳市勤蜂装饰工程 | 尚为传动-专业高精密蜗轮蜗杆,双导程蜗轮蜗杆,蜗轮蜗杆减速机,蜗杆减速机生产厂家 | 应急灯_消防应急灯_应急照明灯_应急灯厂家-大成智慧官网 | 螺旋压榨机-刮泥机-潜水搅拌机-电动泥斗-潜水推流器-南京格林兰环保设备有限公司 | 光伏家 - 太阳能光伏发电_分布式光伏发电_太阳能光伏网 | 广东燎了网络科技有限公司官网-网站建设-珠海网络推广-高端营销型外贸网站建设-珠海专业h5建站公司「了了网」 | 江苏齐宝进出口贸易有限公司 | 仿清水混凝土_清水混凝土装修_施工_修饰_保护剂_修补_清水混凝土修复-德州忠岭建筑装饰工程 | 口信网(kousing.com) - 行业资讯_行业展会_行业培训_行业资料 | 青岛代理记账_青岛李沧代理记账公司_青岛崂山代理记账一个月多少钱_青岛德辉财税事务所官网 | 企业彩铃制作_移动、联通、电信集团彩铃上传开通_彩铃定制_商务彩铃管理平台-集团彩铃网 | 光泽度计_测量显微镜_苏州压力仪_苏州扭力板手维修-苏州日升精密仪器有限公司 | 超高频感应加热设备_高频感应电源厂家_CCD视觉检测设备_振动盘视觉检测设备_深圳雨滴科技-深圳市雨滴科技有限公司 | 油漆辅料厂家_阴阳脚线_艺术漆厂家_内外墙涂料施工_乳胶漆专用防霉腻子粉_轻质粉刷石膏-魔法涂涂 | 尾轮组_头轮组_矿用刮板_厢式刮板机_铸石刮板机厂家-双驰机械 |