Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

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


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:

- master

  vmImage: 'windows-latest'

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

- task: NuGetToolInstaller@1

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

- task: VSBuild@1
    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
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
I added a file "NuGet.config" like so:
<?xml version="1.0" encoding="utf-8" ?>
    <add key="" value="" />
    <add key="Episerver NuGet Feed" value="" />
When I run the pipeline, I get the following error at the build stage:
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.
Publish Pipeline Deploy phase Stage PipelineMsdeploySpecificTransformPhase
Creating directory "obj\integration\Package\PackageTmp".
Copying all files to temporary location below for package/publish:
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.
Edited, May 30, 2020 19:19

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

May 31, 2020 12:10

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

    <Content Include="App_Data\EPiServerDB_f3fdc59f.mdf" />
    <Content Include="App_Data\EPiServerDB_f3fdc59f_log.ldf">
    <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?

Edited, May 31, 2020 14:41

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">
May 31, 2020 16:12

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).

May 31, 2020 21:39

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

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.