0
votes

My team have got a Visual Studio solution with 2 projects in it - 1 is an Umbraco website project, the other is a data access layer named Core. The Umbraco project has the data access layer as a dependency at build time, with the Umbraco project being published to an Azure Website.

We are using publish profiles downloaded from Azure and imported into the solution and saved as .pubxml format - standard.

When we do a publish inside Visual Studio, the Umbraco project builds and compiles the Core project as a .dll before deploying to Azure. This works fine.

However, this project is using TeamCity for continuous integration with the solution built using the Visual Studio (sln) build step. Before we introduced the second Core project it had been building/deploying correctly.

Since creating the second Core project as a dependency, the build now fails in TeamCity only. It appears to be searching for the publish profile in both projects when we have only saved it in the Umbraco project (the one we wish to deploy).

I'm unsure where the issue lies. We only want the publish profile to apply to the Umbraco project we wish to deploy, not the Core one which just needs building/compiling.

Here is the TeamCity build config output including the MSBuild output:

[16:27:38] Checking for changes
[16:27:38] Collecting changes in 1 VCS root (1s)
[16:27:46] Building incremental patch for VCS root: Dev; checkout rules: =>; revision: 974f210ed3bdcb5b0f01cfd9f88fdd8335330cdd --> 974f210ed3bdcb5b0f01cfd9f88fdd8335330cdd
[16:27:41] Publishing internal artifacts
[16:27:41] Clearing temporary directory: C:\BuildAgent\temp\buildTmp
[16:27:41] Checkout directory: C:\BuildAgent\work\507e9be5fde8efc1
[16:27:41] Updating sources: server side checkout (5s)
[16:27:46] Step 1/4: Install NPM dependencies (Command Line) (1s)
[16:27:48] Step 2/4: Grunt tasks (Command Line) (3s)
[16:27:51] Step 3/4: Build solution and deploy (Visual Studio (sln)) (4s)
[16:27:52]   [Step 3/4] Starting: C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:C:\BuildAgent\work\507e9be5fde8efc1 "/msbuildPath:C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe"
[16:27:52]   [Step 3/4] in directory: C:\BuildAgent\work\507e9be5fde8efc1
[16:27:53]   [Step 3/4] Umbraco\Umbraco.csproj.teamcity: Build target: Build (2s)
[16:27:53]     [Umbraco\Umbraco.csproj.teamcity] CheckPrerequisites
[16:27:53]     [Umbraco\Umbraco.csproj.teamcity] RestorePackages
[16:27:54]     [Umbraco\Umbraco.csproj.teamcity] GetReferenceAssemblyPaths
[16:27:54]     [Umbraco\Umbraco.csproj.teamcity] ResolveProjectReferences (1s)
[16:27:54]       [ResolveProjectReferences] MSBuild (1s)
[16:27:54]         [MSBuild] Core\Core.csproj: Build default targets (1s)
[16:27:54]           [Core\Core.csproj] CheckPrerequisites
[16:27:54]           [Core\Core.csproj] RestorePackages
[16:27:54]           [Core\Core.csproj] GetReferenceAssemblyPaths
[16:27:54]           [Core\Core.csproj] ResolveAssemblyReferences
[16:27:55]           [Core\Core.csproj] CoreCompile
[16:27:55]           [Core\Core.csproj] _CopyAppConfigFile
[16:27:55]           [Core\Core.csproj] CopyFilesToOutputDirectory
[16:27:55]           [Core\Core.csproj] ValidatePublishProfileSettings
[16:27:55]             [ValidatePublishProfileSettings] GetPublishingLocalizedString
[16:27:55]             [ValidatePublishProfileSettings] GetPublishingLocalizedString
[16:27:55]               [GetPublishingLocalizedString] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4331, 5): The value for PublishProfile is set to 'publish-profile-dev', expected to find the file at 'C:\BuildAgent\work\507e9be5fde8efc1\Core\Properties\PublishProfiles\publish-profile-dev.pubxml' but it could not be found.
[16:27:55]             [ValidatePublishProfileSettings] GetPublishingLocalizedString
[16:27:55]               [GetPublishingLocalizedString] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4338, 4): PublishProfile(publish-profile-dev) is set. But the $(WebPublishMethod) does not have a valid value.  Current Value is "".
[16:27:55]             [ValidatePublishProfileSettings] Error
[16:27:55]               [Error] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4345, 5): Target ValidatePublishProfileSettings Failed
[16:27:55]   [Step 3/4] Process exited with code 1
[16:27:55]   [Step 3/4] MSBuild output
[16:27:55]     [MSBuild output] (GetReferenceAssemblyPaths target) -> 
[16:27:55]     [MSBuild output]   C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(989,5): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [C:\BuildAgent\work\507e9be5fde8efc1\Umbraco\Umbraco.csproj.teamcity]
[16:27:55]     [MSBuild output] 
[16:27:55]     [MSBuild output] 
[16:27:55]     [MSBuild output] "C:\BuildAgent\work\507e9be5fde8efc1\Umbraco\Umbraco.csproj.teamcity" (Build target) (1) ->
[16:27:55]     [MSBuild output] "C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj" (default target) (3) ->
[16:27:55]     [MSBuild output]   C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(989,5): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj]
[16:27:55]     [MSBuild output] 
[16:27:55]     [MSBuild output] 
[16:27:55]     [MSBuild output] "C:\BuildAgent\work\507e9be5fde8efc1\Umbraco\Umbraco.csproj.teamcity" (Build target) (1) ->
[16:27:55]     [MSBuild output] "C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj" (default target) (3) ->
[16:27:55]     [MSBuild output] (ResolveAssemblyReferences target) -> 
[16:27:55]     [MSBuild output]   C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Transactions" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="mscorlib" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Data" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Configuration" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Web" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Xml" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding> [C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj]
[16:27:55]     [MSBuild output]   C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Windows\Microsoft.NET\Framework\v4.0.30319\\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj]
[16:27:55]     [MSBuild output]   C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj]
[16:27:55]     [MSBuild output]   C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.EnterpriseServices", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj]
[16:27:55]     [MSBuild output]   C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Web", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj]
[16:27:55]     [MSBuild output] 
[16:27:55]     [MSBuild output] 
[16:27:55]     [MSBuild output] "C:\BuildAgent\work\507e9be5fde8efc1\Umbraco\Umbraco.csproj.teamcity" (Build target) (1) ->
[16:27:55]     [MSBuild output] "C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj" (default target) (3) ->
[16:27:55]     [MSBuild output] (ValidatePublishProfileSettings target) -> 
[16:27:55]     [MSBuild output]   C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4331,5): error : The value for PublishProfile is set to 'publish-profile-dev', expected to find the file at 'C:\BuildAgent\work\507e9be5fde8efc1\Core\Properties\PublishProfiles\publish-profile-dev.pubxml' but it could not be found. [C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj]
[16:27:55]     [MSBuild output]   C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4338,4): error : PublishProfile(publish-profile-dev) is set. But the $(WebPublishMethod) does not have a valid value.  Current Value is "". [C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj]
[16:27:55]     [MSBuild output]   C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4345,5): error : Target ValidatePublishProfileSettings Failed [C:\BuildAgent\work\507e9be5fde8efc1\Core\Core.csproj]
[16:27:55]     [MSBuild output] 
[16:27:55]     [MSBuild output]     7 Warning(s)
[16:27:55]     [MSBuild output]     3 Error(s)
[16:27:55]     [MSBuild output] 
[16:27:55]     [MSBuild output] Time Elapsed 00:00:02.37
[16:27:56]   [Step 3/4] Step Build solution and deploy (Visual Studio (sln)) failed
[16:27:56] Step 4/4: Fin. (Command Line)
[16:27:56] Publishing internal artifacts
[16:27:57] Build finished

Any ideas on how I can fix this?

Edit: Here are the build parameters included in the Visual Studio (sln) build step:

DeployOnBuild       True
ExcludeFoldersFromDeployment        App_Data\Logs;App_Data\preview;Build
Password        biglongazurepasswordwhichiveobfuscated
ProfileTransformWebConfigEnabled        False
PublishProfile      publish-profile-dev
PublishProfileRootFolder        %teamcity.build.checkoutDir%\Umbraco\Properties\PublishProfiles
1

1 Answers

0
votes

Very simple fix found for this. The Core project had been added as a Web Application to Visual Studio, rather than a Class Library. So it was always going to try and publish it.

The actual fix was to update the GUID in the Core.csproj file, as per https://stackoverflow.com/a/10878686/4498130