Syncing multiline Powershell script with VCS

We just enabled VCS integration and are receiving the following error message: 

> BuildType 'ServiceControl_NewBuil', build step [5/5]: mandatory 'scriptMode.content' property is not specified

This build configuration has a PowerShell script step with the following:

@"
`$Branch = "%GitVersion.BranchName%"
`$Version = "%GitVersion.LegacySemVer%"
`$Product = "%system.teamcity.projectName%"
`$Major = "%GitVersion.Major%"
`$Minor = "%GitVersion.Minor%"
`$Commit = "%GitVersion.Sha%"
"@ > Metadata.ps1

In the VCS, this is being translated to:

powerShell {
  name = "Create metadata"
  platform = PowerShellStep.Platform.x86
  edition = PowerShellStep.Edition.Desktop
  formatStderrAsError = true
  scriptMode = script {
  content = """
  @"
  `${'$'}Branch = "%GitVersion.BranchName%"
  `${'$'}Version = "%GitVersion.LegacySemVer%"
  `${'$'}Product = "%system.teamcity.projectName%"
  `${'$'}Major = "%GitVersion.Major%"
  `${'$'}Minor = "%GitVersion.Minor%"
  `${'$'}Commit = "%GitVersion.Sha%"
  "@ > Metadata.ps1
  """.trimIndent()
  }
 

}

So it looks like either the multi-line string or the double quotes are causing issues. Do we have this formatted correctly?

0
3 comments

Hi Kyle,

 

I've copied this, pasted it into my IDE, synced the settings with the server and the step was added just fine, using 2018.1.2. Are you still facing the issue?

0
Avatar
Permanently deleted user

Hi Denis,

Technically, no, we're not because we disabled VCS syncing for the time being. We did have a similar step in another config which didn't throw the error so I'm not sure what was special about this one.

0

A typical scenario for this kind of situations are encoding issues. If other similar ones work, I'd recommend copying those that work, modifying manually, then checking whether it breaks at some point and identify the core of the issue. If you can locate it and replicate it consistently, please report it to our tracker: https://youtrack.jetbrains.com/issues/TW

0

Please sign in to leave a comment.