Visual Studio 2019 với StyleCop (edit)

  • Visual Studio 2017 Enterprise
  • StyleCop-4.7.55.0.msi
  • wix40.exe
  • InstallerProjects.vsix
  • Microsoft .NET Framework 3.5 + WCF and IIS
  • Microsoft SDKs (Windows 10)
  • Microsoft SQL Server 2008 R2

Build & Deploy ASP.NET Web API 2 in Visual Studio 2019

+ Create Publish profile (named FolderProfile)

+ Run CMD with Administrator

+ Enter the command:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" "C:\Path\To\AspNetWebApi2.csproj" /p:DeployOnBuild=true /p:PublishProfile=FolderProfile

Microsoft.WebApplication.targets was not found during web application build

https://stackoverflow.com/questions/44061932/ms-build-2017-microsoft-webapplication-targets-is-missing/

Create an Installer

  1. "C:\Program Files (x86)\WiX Toolset v4.0\bin\WixToolset.Dtf.WindowsInstaller.dll"
  2. "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"
  3. "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe”
  4. "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools"
  5. Visual Studio Version = "15.0"

StyleCop

Sửa trong file này: C:\Program Files (x86)\MSBuild\StyleCop\v4.7\StyleCop.Targets

Start > Run > CMD (with Admin) > notepad C:\Program Files (x86)\MSBuild\StyleCop\v4.7\StyleCop.Targets

Sửa đoạn text này: $(MSBuildExtensionsPath)\..\StyleCop 4.7\StyleCop.dll

thành đoạn text này: C:\Program Files (x86)\StyleCop 4.7\StyleCop.dll

How TO

notepad C:\Program Files (x86)\MSBuild\StyleCop\v4.7\StyleCop.Targets

Replace $(MSBuildExtensionsPath)\..\StyleCop 4.7\StyleCop.dll with C:\Program Files (x86)\StyleCop 4.7\StyleCop.dll

References:

https://github.com/StyleCop

https://www.nuget.org/packages/StyleCop.MSBuild/