I have a build definition setup in Team Services that is publishing the web.config file as an additional artifact so that I can run the tokenizer task on it. In my visual studio project I have the tokens setup in the Web.Release.config file. When the build is run, the tokens are inserted in to the config file which are then replaced by the release management process for each of the environments.
This has been working for the past few months. But today it started failing with the error "not found PathtoPublish" for the web.config file. In the Publish Artifacts task, I have the Path to publish setup as
"MyWebProject\obj\Release\Package\PackageTmp\Web.config".
Looks like now it is expecting a path like
"SolutionFolder\Branch\MyWebProject\obj\Release\Package\PackageTmp\Web.config".
I guess I need to use a variable for the path. But I cant figure out whats the right variable. I need to pick up the transformed Web.config file so that the tokens are in place. Strange thing the old path is working fine for a 2nd team projects build definition.
This may caused by the build definition change as baywet mentioned, especially the "Mappings" section under "Repository" tab.
There isn't any variable refer to the path of web.config
file directly. The alternative way would be:
Use "Copy and Publish Build Artifacts" task, specify $(Build.SourcesDirectory)
as the "Copy Root" and **\PackageTmp\Web.config
as the "Contents". This will search the web.config
file under PackageTmp
folder and publish it.
Or you can add /P:outputpath="$(build.artifactstagingdirectory)\Temp"
argument in "Visual Studio Build" step to copy the output files into $(build.artifactstagingdirectory)\Temp
folder and then in the "Publish Artifacts task" step, you can enter $(build.artifactstagingdirectory)\Temp\_PublishedWebsites\YourProjectName\Web.config
to publish the web.config
file.