Deploying to Azure

Topics: General
Oct 13, 2011 at 8:50 PM

I started messing with Orchard about 5 days ago.  I downloaded Orchard.Web.1.3.9.zip and started to experiment.  I have about 40 hours of work into the code on my local hard drive.  I've decided this is a viable solution for the project I am working on, and now I would like to deploy to Azure to show it off. 

Started reading the Deploying Orchard To Windows Azure document and have to admit I am lost. 

I started by downloading the *.proj & *.cmd files from the Source Code tab above.  Running ClickToBuildAzurePackage.cmd fails because I don't have any of the src directories.  So I decide maybe I'll do the first part of this with the source package and see about moving what I have currently up later.

I download the Orchard.Source.1.3.9.zip file, and attempt to run ClickToBuildAzurePackage.cmd.  I get the following error...

Project "c:\work\Orchard.Source.1.3.9\AzurePackage.proj" on node 1 (Build target(s)).
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(483,9): error : The OutputPath property is not set for project 'AzurePackage.proj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration=''  Platform='X64'.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [c:\work\Orchard.Source.1.3.9\AzurePackage.proj]
Done Building Project "c:\work\Orchard.Source.1.3.9\AzurePackage.proj" (Build target(s)) -- FAILED.

Any help would be appreciated.

Coordinator
Oct 13, 2011 at 9:06 PM

Please try to install the SDK updates first : http://www.microsoft.com/windowsazure/sdk/

Then using the full source code of Orchard, and the ClickToBuildAzurePackage.cmd script should work. You will need to add any custom module or theme to the solution first, as explained in the documentation.

Oct 14, 2011 at 3:48 AM

Thanks for the reply sebastion. 

Before doing the above steps, I successfully ran the install for Windows Azure Tools for Microsoft Visual Studio 2010 - September 2011 from Web PI. 

Are the files newer on the website you referenced than the files coming from Web PI?

I'm away from my work PC, so I can't test this right now.

Oct 14, 2011 at 3:00 PM

I've checked on the link that you sent, and I am all up to date on all the dependencies.  I tried to install the hotfix for my Windows 7 machine and the installer tells me that 'The update is not applicable to your computer'. 

Can you give me any other suggestions?

Oct 14, 2011 at 6:22 PM

Upon further review, the AzurePackage.proj file is riddled with errors.  Not sure how it would have ever worked.  I'll paste my version here with my fixes.  Hope it helps someone else.

 

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Initialization -->

  <PropertyGroup>
	<OutputPath>.\Fred</OutputPath>
    <LibFolder>$(MSBuildProjectDirectory)\lib</LibFolder>
    <SrcFolder>$(MSBuildProjectDirectory)\src</SrcFolder>
    <BuildFolder>$(MSBuildProjectDirectory)\buildazure</BuildFolder>
    <ArtifactsFolder>$(MSBuildProjectDirectory)\artifacts\Azure</ArtifactsFolder>

    <CompileFolder>$(BuildFolder)\Compile</CompileFolder>
    <ServiceFolder>$(CompileFolder)\Orchard.Azure.CloudService.csx</ServiceFolder>
    <CloudRootFolder>$(ServiceFolder)\roles\Orchard.Azure.Web\approot</CloudRootFolder>
    <WebSitesFolder>$(CompileFolder)\_PublishedWebsites</WebSitesFolder>
    <StageFolder>$(BuildFolder)\Stage</StageFolder>
    <MsDeployFolder>$(SrcFolder)\Orchard.Azure\Orchard.Azure.Web\obj\Release\Package\PackageTmp</MsDeployFolder>
    
  </PropertyGroup>
  
  <Import Project="$(LibFolder)\msbuild\MSBuild.Community.Tasks.Targets"/>
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Windows Azure Tools\1.5\Microsoft.WindowsAzure.targets" />

<!-- Coordinating Targets -->

  <Target Name ="Build">
    <CallTarget Targets="Clean"/>
    <CallTarget Targets="Compile"/>
    <!--<CallTarget Targets="Test"/>-->
    <CallTarget Targets="Package"/>
  </Target>

  <Target Name ="CIBuild">
    <CallTarget Targets="Clean"/>
    <CallTarget Targets="Compile"/>
    <CallTarget Targets="Package"/>
  </Target>

  <Target Name="Package">
    <CallTarget Targets="Package-ForCloud"/>
    <CallTarget Targets="Package-SqlCe" />    
    <CallTarget Targets="Package-Stage"/>
    <CallTarget Targets="Package-Zip"/>
  </Target>


<!-- Building -->

  <Target Name="Clean">
    <MSBuild Projects="$(SrcFolder)\Orchard.Azure\Orchard.Azure.sln" 
		Targets="Clean"
		Properties="Configuration=Release;DeployOnBuild=true;DeployTarget=Package;Platform=Any CPU" 
	/>
    <RemoveDir Directories="$(BuildFolder)" ContinueOnError="true" />
    <RemoveDir Directories="$(MsDeployFolder)" ContinueOnError="true" />
  </Target>

  <Target Name ="Compile">

    <!-- behaves like MsDeploy since Azure SDK 1.4, output is $(MsDeployFolder) -->
    <MSBuild
      Projects="$(SrcFolder)\Orchard.Azure\Orchard.Azure.sln"
      Targets="Build"
      Properties="Configuration=Release;DeployOnBuild=true;DeployTarget=Package;Platform=Any CPU" 
     />
    
    <MSBuild
      Projects="$(SrcFolder)\Orchard.Azure.Tests\Orchard.Azure.Tests.sln"
      Targets="Build"
      Properties="Configuration=Release;OutputPath=$(MsDeployFolder)\bin;Platform=Any CPU" 
    />
    
  </Target>


<!-- Testing - Azure only -->

  <Target Name ="Test">

    <CreateItem Include="$(CompileFolder)\*Azure.Tests.*dll">
      <Output TaskParameter="Include" ItemName="TestAssemblies" />
    </CreateItem>

    <NUnit Assemblies="@(TestAssemblies)" ToolPath="$(LibFolder)\nunit" WorkingDirectory="$(MsDeployFolder)\bin" />
  </Target>

<!-- Packaging -->

  <Target Name="Package-ForCloud">
    
    <ItemGroup>
      <!-- filter to exclude any binary from a folder -->
      <Excluded Include="$(SrcFolder)\**\bin\**\*;$(SrcFolder)\**\obj\**\*;" />
<!--
      <Web-Excluded Include="$(SrcFolder)\**\_bin_deployableAssemblies\**\*;$(SrcFolder)\**\Properties\**\*;$(SrcFolder)\**\*.csproj*;$(SrcFolder)\**\*.proj;$(SrcFolder)\**\Modules\**\*;$(SrcFolder)\**\Core\**\*;$(SrcFolder)\**\Themes\**\*;$(SrcFolder)\**\bin\**\*;$(SrcFolder)\**\obj\**\*;" />
-->
      <!-- list of files from Themes, Core and Modules to export -->
      <Stage-Themes Include="$(SrcFolder)\Orchard.Web\Themes\**\*" Exclude="@(Excluded)" />
      <Stage-Core Include="$(SrcFolder)\Orchard.Web\Core\**\*" Exclude="@(Excluded)" />
      <Stage-Modules Include="$(SrcFolder)\Orchard.Web\Modules\**\*" Exclude="@(Excluded)" />
<!--
      <Stage-Web Include="$(SrcFolder)\Orchard.Azure\Orchard.Azure.Web\**\*" Exclude="@(Web-Excluded)" />
      <Stage-Assemblies Include="$(SrcFolder)\**\bin\**\*" />
      <Stage-Bin-Assemblies Include="$(SrcFolder)\Orchard.Azure\Orchard.Azure.Web\_bin_deployableAssemblies\*" />
      <Stage-Entry-Assembly Include="$(CompileFolder)\Orchard.Azure.Web.dll" />
-->
    </ItemGroup>

    <Copy SourceFiles="@(Stage-Themes)" DestinationFolder="$(MsDeployFolder)\Themes\%(RecursiveDir)" />
    <Copy SourceFiles="@(Stage-Core)" DestinationFolder="$(MsDeployFolder)\Core\%(RecursiveDir)" />
    <Copy SourceFiles="@(Stage-Modules)" DestinationFolder="$(MsDeployFolder)\Modules\%(RecursiveDir)" />
<!--
    <Copy SourceFiles="@(Stage-Web)" DestinationFolder="$(CloudRootFolder)\%(RecursiveDir)" />
    <Copy SourceFiles="@(Stage-Assemblies)" DestinationFolder="$(CloudRootFolder)\bin" />
    <Copy SourceFiles="@(Stage-Bin-Assemblies)" DestinationFolder="$(CloudRootFolder)\bin" />
    <Copy SourceFiles="@(Stage-Entry-Assembly)" DestinationFolder="$(CloudRootFolder)\" />
-->
    <!--Delete Files="$(CloudRootFolder)\App_Data" /-->

    <ItemGroup>
      <WebConfigs Include="$(MsDeployFolder)\Modules\*\web.config;$(MsDeployFolder)\Core\web.config" />
    </ItemGroup>

    <Delete Files="@(WebConfigs)" />

    <!-- extra processing of the staged config files -->
    <XmlUpdate XmlFileName="$(MsDeployFolder)\web.config"
      XPath="/configuration/system.web/compilation/@debug"
      Value="false" />

    <XmlUpdate XmlFileName="$(MsDeployFolder)\Config\log4net.config"
      XPath="/log4net/appender/immediateFlush/@value"
      Value="false" />

    <XmlUpdate XmlFileName="$(MsDeployFolder)\Config\log4net.config"
      XPath="/log4net/logger/priority/@value"
      Value="ERROR" />

    <XmlUpdate XmlFileName="$(MsDeployFolder)\Config\log4net.config"
      XPath="/log4net/root/priority/@value"
      Value="ERROR" />

    <Copy 
        SourceFiles="$(SrcFolder)\Orchard.Azure\Orchard.Azure.CloudService\ServiceConfiguration.cscfg" 
        DestinationFolder="$(StageFolder)" 
      />

    <Copy 
        SourceFiles="$(SrcFolder)\Orchard.Azure\Orchard.Azure.CloudService\Properties.txt" 
        DestinationFolder="$(ServiceFolder)" 
      />

  </Target>
  
  <Target Name="Package-SqlCe">
    <ItemGroup>
      <SqlCeBinariesx86 Include="$(LibFolder)\sqlce\x86\**\*" />
      <SqlCeBinariesx64 Include="$(LibFolder)\sqlce\amd64\**\*" />
    </ItemGroup>
    <Copy SourceFiles="@(SqlCeBinariesx86)" DestinationFolder="$(MsDeployFolder)\bin\x86\%(RecursiveDir)" SkipUnchangedFiles="true" />
    <Copy SourceFiles="@(SqlCeBinariesx64)" DestinationFolder="$(MsDeployFolder)\bin\amd64\%(RecursiveDir)" SkipUnchangedFiles="true" />
  </Target>
  
  <Target Name="Package-Stage">
    <Exec
        Command="&quot;$(ServiceHostingSDKBinDir)cspack&quot; &quot;$(SrcFolder)\Orchard.Azure\Orchard.Azure.CloudService\ServiceDefinition.build.csdef&quot; /role:Orchard.Azure.Web;&quot;$(MsDeployFolder)&quot;;Orchard.Azure.Web.dll /sites:Orchard.Azure.Web;Web;&quot;$(MsDeployFolder)&quot; /rolePropertiesFile:Orchard.Azure.Web;&quot;$(ServiceFolder)\Properties.txt&quot; /out:&quot;$(StageFolder)\Orchard.Azure.Web.cspkg&quot;"
        WorkingDirectory="$(MsDeployFolder)" 
      />
  </Target>

  <Target Name="Package-Zip">
    <ItemGroup>
      <Zip-Stage Include="$(StageFolder)\ServiceConfiguration.cscfg;$(StageFolder)\Orchard.Azure.Web.cspkg" />
    </ItemGroup>
    
    <MakeDir Directories="$(ArtifactsFolder)" />
    <Zip Files="@(Zip-Stage)" WorkingDirectory="$(StageFolder)" ZipFileName="$(ArtifactsFolder)\AzurePackage.zip" />
  </Target>
</Project>

Coordinator
Oct 14, 2011 at 7:37 PM

There are known issues with this release right now. Good news is that you are helping, and that I am also working on it right now. Fixes should be published on default branch today, and a fully functional package too.

Coordinator
Oct 14, 2011 at 7:53 PM

Simple question ... what would make you changes work better than the current version ?
I just found adding Properties="" in the Clean target, and Platform=AnyCPU instead on PlatformTarget=x64, whcih actually was not taken into account because of the wrong attribute name, so defaulting to AnyCPU.

Oct 14, 2011 at 8:26 PM

OK, I see where the disconnect is.  I am running the x64 version of the Visual Studio command prompt.  When defaulting to a solution configuration in the case of missing properties, the x64 command window uses x64.

 

 

Coordinator
Oct 14, 2011 at 11:48 PM

Published on Default, plus a few other fixes.

Oct 18, 2011 at 4:43 AM

I have the new build but when I run clicktobuildazurepackage it runs all the way through the build and then when the unit tests start it just hangs and never completes. The last line I see in the output is "TeamCity addin installed". I have previously built successfully on Orchard 1.2 with the 1.3 SDK.

Sean

Coordinator
Oct 18, 2011 at 4:52 AM
Please try with the SDK 1.5

Sent from my TI-99/4A

From: sncodeplex
Sent: 10/17/2011 8:44 PM
To: Bertrand Le Roy
Subject: Re: Deploying to Azure [orchard:275806]

From: sncodeplex

I have the new build but when I run clicktobuildazurepackage it runs all the way through the build and then when the unit tests start it just hangs and never completes. The last line I see in the output is "TeamCity addin installed". I have previously built successfully on Orchard 1.2 with the 1.3 SDK.

Sean

Oct 18, 2011 at 5:23 AM

I am using Orchard 1.3, updated with Sebastien's updates from Friday and the Azure 1.5 SDK.

Sean 

Coordinator
Oct 18, 2011 at 5:34 PM

Is there any error message which could lead us to the issue ? Or can you do a ClickToBuildAzurePackage > output.txt to get the full log ?

Oct 19, 2011 at 2:54 AM

That's the thing, there are no errors at all. But I have found a fix/workaround - I removed the addins folder below the nunit folder so that nunit no longer loads the TeamCity addin and everything is working fine - the storage emulator loads and the tests all run successfully (24 tests). I don't have TeamCity, but the Azure build has always worked fine before.

Let me know if there are any error logs you'd like me to look at - I don't see any for TeamCity so it's hard to know what the issue is.

Sean