If you want to use pre-built Hyper-V Agent Installer then you can download from jenkins.
For master you can download from http://jenkins.buildacloud.org/job/cloudstack-master-hyperv-agent and for other releases search for appropriate job at http://jenkins.buildacloud.org/ .
To build on windows you have to follow instructions of step 1 at https://cwiki.apache.org/confluence/display/CLOUDSTACK/Setting+up+a+CloudStack+dev+environment+on+Windows.
In addition to packages mentioned there you have to select wget package also.
Install mono on windows. You can download mono from http://www.go-mono.com/mono-downloads/download.html.
Before building import all certificates using below command in Cygwin
mozroots --import --ask-remove
After setting up the environment you can build the agent using Cygwin. In Cygwin you have to execute buildagent.sh script. This script is present in (cloudstack src folder)/plugins/hypervisors/hyperv
To build on Linux you can refer to Donal's blog http://dlafferty.blogspot.in/2013/08/building-your-microsoft-solution-with.html.
After building you will get the output/executable in (cloudstack src folder)//plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/bin/Debug
That output folder can be zipped and can be distributed.
In that output folder there is one executable generated AgentShell.exe.
From command line that can be used to install and uninstall service as follows
To install service
where username is of form domain\username or username for example Administrator or blr\Administrator
This user should be part of local Administrators and Hyper-V Administrators group on the host
To uninstall service
Note: Apart from installing service you have to manually create and add ssl certificate. For that you can follow the steps here https://cwiki.apache.org/confluence/display/CLOUDSTACK/Manually+Creating+and+installing+self+signed+certificate+for+CloudStack+Management+Server+communication+with+Hyper-V+agent
First you have to download the source code from github https://github.com/anshul1886/CloudStackAgentSetup.
Copy the InstallerSetup folder in (cloudstack src folder)//plugins/hypervisors/hyperv/DotNet/
After building the agent run one of the following command in (cloudstack src folder)//plugins/hypervisors/hyperv/DotNet/InstallerSetup/CloudStackAgentSetup
or
Installer will be generated in bin/debug folder of CloudAgentSetup proj (cloudstack src folder)//plugins/hypervisors/hyperv/DotNet/InstallerSetup/CloudStackAgentSetup/bin/Debug
CloudStackAgentSetup code uses the WixCommonUiExtension.dll with Eclipse Public License https://github.com/dblock/msiext/blob/master/LICENSE
To install msi through command line quietly one can use the following command
msiexec /i CloudStackAgentSetup.msi /quiet /qn /norestart /log install.log SERVICE_USERNAME=<username> SERVICE_PASSWORD=<password>
If you don't want to install certificate with installer then execute as follows
msiexec /i CloudStackAgentSetup.msi /quiet /qn /norestart /log install.log SERVICE_USERNAME=<username> SERVICE_PASSWORD=<password> INSTALL_CERTIFICATE="False"
Create .bat script which does the following
Create and deploy a scheduled task via group policy
Link this Group Policy to one or more OUs and under Security Filtering, add Authenticated Users and Domain Computers.
For more details refer to http://www.jasonpearce.com/2010/11/17/deploy-software-via-group-policys-scheduled-tasks/
Add the project to visual Studio and build it Visual Studio as normal build
(cloudstack src folder)//plugins/hypervisors/hyperv/DotNet/InstallerSetup/CloudStackAgentSetup
If any command is not working make sure that it is environment path
To get msbuild on path add the following path to Path environment variable
C:\Windows\Microsoft.NET\Framework\v4.0.30319
.