msbuild - 如何使用 MSBuild 和 MS Virtual Server 和/或 Hyper-V Server Virtualization 创建虚拟机作为构建过程的一部分?

标签 msbuild virtualization hyper-v

我想做的是创建一个干净的虚拟机镜像作为应用程序构建的输出。

因此,将创建一个新的虚拟机(从模板即可,安装了操作系统,并安装了一些基本软件)——将在 IIS 中创建一个新网站,并将 Web 应用程序构建输出复制到虚拟机硬盘上的一个位置,并且 IIS 配置正确,虚拟机将启动并运行。

我知道有 MSBuild 任务来编写 IIS 中所有管理操作的脚本,但是如何使用虚拟机编写所有操作的脚本?具体来说,从模板创建一个新的虚拟机,对其进行唯一命名,启动它,配置它等等......

具体来说,我想知道是否有人已成功实现任何虚拟机脚本作为构建过程的一部分。

更新:我假设使用 Hyper-V,有一组不同的库/API 来编写虚拟机脚本,有人使用过吗?有谁有真正的实践经验来做这样的事情吗?

最佳答案

结账 Powershell Management library for Hyper-V on CodePlex 。一些功能:

Finding a VM
Connecting to a VM
Discovering and manipulating Machine states
Backing up, exporting and snapshotting VMs
Adding and removing VMs, configuring motherboard settings.
Manipulating Disk controllers, drives and disk images
Manipluating Network Interface Cards
Working with VHD files

关于msbuild - 如何使用 MSBuild 和 MS Virtual Server 和/或 Hyper-V Server Virtualization 创建虚拟机作为构建过程的一部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11720/

相关文章:

visual-studio-2010 - TFS 构建未按预期转换 web.config

linux - Jenkins 上带有单声道的 MSBUILD

visual-studio - .net core 项目依赖项 - 黄色三角形

windows-server-2003 - Web访问虚拟机

android - 如果我正在使用 Cordova 开发移动应用程序,我该如何使用其他 Android 模拟器?

kubernetes - Windows 10 Enterprise 和 Hyper-V 中的 Minikube

c# - MSBuild web.config 转换不工作

linux - Docker 从部分图像中理解

android - 在 Windows 10 上为 Android Studio 安装 HAXM

powershell - Hyper-V 2012R2使用Powershell获取VM快照文件