We have approximately 40 projects in our solution of which the main 3 are a web application, a windows service and a database migration application.
I have setup an Azure virtual machine with the octopus deployment application on and a tentacle. I am using the following build command in a batch file to test at the moment:
set msBuildDir=%WINDIR%\Microsoft.NET\Framework64\v4.0.30319
call %msBuildDir%\msbuild.exe "{SolutionFile}" /p:Configuration=Deployment-OctopusDeploy /p:RunOctoPack=true /p:OctoPackPackageVersion=%1 /p:OctoPackPublishPackageToHttp=http://localhost/OctopusDeploy/nuget/packages /p:OctoPackPublishApiKey={OURAPIKEY}
I had to create a new configuration that did not build the Azure Cloud Services project to prevent the double build on the main web application which tried to deploy the NuGet package twice. I also had to pass in the version number as in our assembly file we have the version number as follows:
[assembly: AssemblyVersion("2.62.*")]
And we were getting an error saying 2.62.* is not a valid version number, so we put the batch file in a console app, loaded the version number from there like below and passed it into the batch file in a process.
public static string CurrentVersion
{
get
{
if (String.IsNullOrWhiteSpace(_currentVersion))
{
Assembly assembly = Assembly.GetExecutingAssembly();
var version = assembly.FullName.Split(',')[1];
var fullversion = version.Split('=')[1];
_currentVersion = fullversion;
}
return _currentVersion;
}
}
We also have a dev and main branch and our end goal is the following:
We wanted to have our TFS online build on check-in to either dev or main and pass the OctoPack parameters to the MsBuild agent and if the NuGet packages are from the dev branch append them with dev and if they are from the main branch append them with main. Also we wanted the version read correctly out rather than having to fire from a console application which I do not believe we can do with the online version of TFS build.
Is this possible with OctoPack and visual studio online? What is the common methods for handling this scenario as I am sure there are many people using Visual Studio Online/Branching/Octopus Deploy.
Many thanks for any help/advice