Im getting this error on Team Services release. I suspected that this error occours because im generating a zipped artifact.
The MSBuild configuration:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"
Then in my Release im trying to replace the appsettings.json
variables:
So the artifact is a zip file and problably because this the release management is not finding the appsettings.json file. But what is the way to deal with it? Build an artifact not zipped?
This worked for me:
**/appsettings.json
The json file is buried down in a long deep path based on the location of the agent and how MSBuild packages it up...it's not at the "root".
For example, my json file was in this folder within the WebApp.zip file:
WebApp.zip\Content\C_C\Build\Agent\agent_work\3\s\CrmsAngularPOC\obj\Release\netcoreapp1.1\PubTmp\Out
You should use JSONPath expressions to specify variable(s) you want to substitute for Json variable substitution option.
Detail usage of JSON variable substitution as below:
Provide new line separated list of JSON files to substitute the
variable values. Files names are to be provided relative to the root
folder. To substitute JSON variables that are nested or hierarchical,
specify them using JSONPath expressions.
For example, to replace the value of ‘ConnectionString
’ in the
sample below, you need to define a variable as
‘Data.DefaultConnection.ConnectionString’ in the build/release
definition (or release definition’s environment).
{
"Data": {
"DefaultConnection": {
"ConnectionString": "Server=(localdb)\SQLEXPRESS;Database=MyDB;Trusted_Connection=True"
}
}
}
Variable Substitution is run after configuration transforms.
Note: Build/Release’s system definition variables are excluded in
substitution