November Happy Hour will be moved to Thursday December 5th.

build pipeline for alloy on devops fails: Copying file App_Data\EPiServerDB_f3fdc59f.mdf

Vote:
 

I have the alloy project pushed to a devops git repo.  I can get the project to work in Azure, setup to mimic DXC as per "developing for DXC" course, and deployed using Visual studios publish tool.  Now I need to find a way to get it to build automatically using devlops piplines, which just doesnt seem to work.

I created the following azure-pipelines.yml:

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Integration'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '$(solution)'
    feedsToUse: 'config'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
I added a file "NuGet.config" like so:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="Episerver NuGet Feed" value="https://nuget.episerver.com/feed/packages.svc/" />
  </packageSources>
</configuration>
When I run the pipeline, I get the following error at the build stage:
PostAutoParameterizationWebConfigConnectionStrings:
Auto ConnectionString Transformed Views\Web.config into obj\integration\CSAutoParameterize\transformed\Views\Web.config.
Auto ConnectionString Transformed modules\_protected\Shell\web.config into obj\integration\CSAutoParameterize\transformed\modules\_protected\Shell\web.config.
Auto ConnectionString Transformed modules\_protected\CMS\web.config into obj\integration\CSAutoParameterize\transformed\modules\_protected\CMS\web.config.
Auto ConnectionString Transformed modules\_protected\EPiServer.Cms.TinyMce\web.config into obj\integration\CSAutoParameterize\transformed\modules\_protected\EPiServer.Cms.TinyMce\web.config.
Auto ConnectionString Transformed obj\integration\TransformWebConfig\transformed\Web.config into obj\integration\CSAutoParameterize\transformed\Web.config.
PipelineMsdeploySpecificTransformPhase:
Publish Pipeline Deploy phase Stage PipelineMsdeploySpecificTransformPhase
CopyAllFilesToSingleFolderForMsdeploy:
Creating directory "obj\integration\Package\PackageTmp".
Copying all files to temporary location below for package/publish:
obj\integration\Package\PackageTmp.
Copying bin\DxcAlloy.dll to obj\integration\Package\PackageTmp\bin\DxcAlloy.dll.
Copying App_Data\EPiServerDB_f3fdc59f.mdf to obj\integration\Package\PackageTmp\App_Data\EPiServerDB_f3fdc59f.mdf.
##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\Web\Microsoft.Web.Publishing.targets(2601,5): Error : Copying file App_Data\EPiServerDB_f3fdc59f.mdf to obj\integration\Package\PackageTmp\App_Data\EPiServerDB_f3fdc59f.mdf failed. Could not find file 'App_Data\EPiServerDB_f3fdc59f.mdf'.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\Web\Microsoft.Web.Publishing.targets(2601,5): error : Copying file App_Data\EPiServerDB_f3fdc59f.mdf to obj\integration\Package\PackageTmp\App_Data\EPiServerDB_f3fdc59f.mdf failed. Could not find file 'App_Data\EPiServerDB_f3fdc59f.mdf'. [d:\a\1\s\DxcAlloy.csproj]
Done Building Project "d:\a\1\s\DxcAlloy.csproj" (default targets) -- FAILED.
Done Building Project "d:\a\1\s\DxcAlloy.sln" (default targets) -- FAILED.
The project runs fine in visual studio.
Any ideas?
Is there any tutorial or guide to getting alloy to build and deploy in azure?  I did the "developing for DXC" course, but its so out of date, the build does not work.
#223583
Edited, May 30, 2020 19:19
Vote:
 

Is MDF file included in project, you can verify by opening csproj file in notepad?

#223602
May 31, 2020 12:10
Vote:
 

if i unload the project then edit the project file, it contains this:

  <ItemGroup>
    <Content Include="App_Data\EPiServerDB_f3fdc59f.mdf" />
    <Content Include="App_Data\EPiServerDB_f3fdc59f_log.ldf">
      <DependentUpon>EPiServerDB_f3fdc59f.mdf</DependentUpon>
    </Content>
    <Content Includ

I dont know where this came from, or why its in the csproj file.   Is the mdf created by the build process on each build, or is it created once when you first create the project?

I see the file in my local visual studio. I dont know how to see if the file exists or created in azure pipelines, as you cant access the transient file system it creates (I assume).

If I look in devops at the git repo, the mdf file is not there. I am guessing its in the git.ingore, or somehow vs knows not to check it in.  looking in git ignore, I cant see app_data dir, nor mdf as a file extension, do I dont know how git knows to ignore the file.

Any ideas on how this could be resolved? I am guessing everyone has the same issue?

#223603
Edited, May 31, 2020 14:41
Vote:
 

If it's not in the folder,

Simply remove those line from csproj file using notepad again, save and publish ...r in Vs once .. should work.

<Content Include="App_Data\EPiServerDB_f3fdc59f.mdf" />
    <Content Include="App_Data\EPiServerDB_f3fdc59f_log.ldf">
      <DependentUpon>EPiServerDB_f3fdc59f.mdf</DependentUpon>
    </Content>
#223604
May 31, 2020 16:12
Vote:
 

The mdf is in the folder on my pc, but presumably not on the pipeline server.  

Presumably, the mdf was created by running the build on the pc, so why is it not created by the same proj file on the pipelines sever?

Does anyone know what this mdf file is for? Presumably, if I modify something which modifies the schema, I need it to build this file?

Its not in the gitignore, but adding the project into git did not add this file. Anyone know what causes this anomlly?  If I do git status  there is no mention of this file, even though it exists in my project, but not in git on devops.  If I do git pull, there are no changes. If I do git push , there are no changes.

Does everyone have to hack the csproj file to remove the mdf to use CI servers?  There is no mention of this in the "developing for DXC" course I have just done up to B4, the excercise which gets you to build the project in devops (and doesnt work).

#223607
May 31, 2020 21:39
Vote:
 

Ok, removing the mdf references from csproj file fixed the issue.  Thanks.

#223630
Jun 01, 2020 9:40
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.