我正在尝试设置一个Jenkins CI服务器来部署.NET 4.5应用程序,但我不能在我的生活中找到运行visual studio 2012的Windows 8机器上的msbuild exe。有什么想法吗?
确保您已安装相应的.Net
框架。您可以通过以下示例路径找到build.exe
C:\Windows\Microsoft.NET\Framework\v4.5\MSBuild.exe
找到MSBuild的正确方法是使用注册表。
这是一个找到特定版本的.exe的powershell实现
$regKey = "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\${Version}"
$itemProperty = Get-ItemProperty $RegKey -ErrorAction SilentlyContinue
if ($itemProperty -ne $null -and $itemProperty.MSBuildToolsPath -ne $null)
{
$msBuildPath = Join-Path $itemProperty.MSBuildToolsPath -ChildPath "MsBuild.exe"
}
我不喜欢其他答案。因为在C:\Windows\Microsoft.NET\Framework\
或注册表中,您无法找到随Visual Studio一起安装的新版本的msbuild版本或单独作为构建工具。最好的方法是使用vswhere
find msbuild