tfs build server - string interpolation $ Character is not valid

陌路散爱 提交于 2020-01-03 07:37:09

问题


i am using string interpolation using $ in my code. It compiles fine but when i check in my code, the build server throws an error BC30037: Character is not valid. Following is an example on how i have used string interpolation:

dim r = New RadNode($"{acq.FormNo} -  ${CInt(acq.TotalAmount)}", icon:=RadTreeIcons.RedTriangle)

The build server has Visual Studio 2015 Entreprise edition installed.

If i run this from command prompt:

C:\Program Files (x86)\MSBuild\14.0\Bin>MSBuild /tv:14.0 "Proj.sln", the code compiles file. However if i change the above argument to

C:\Program Files (x86)\MSBuild\14.0\Bin>MSBuild /tv:12.0 "Proj.sln", i get the same error

I have also made these changes:

i have set the MSBuildArguments Property to /p:VisualStudioVersion=14.0 and also changed the TFSBuild.proj file and changed this line to <Project DefaultTargets="DesktopBuild" xmlns="schemas.microsoft.com/developer/msbuild/2003"; ToolsVersion="14.0">" but same issue is happening.

Changed the (web vbproj) file and changed ToolSet Version to 14.0 from 12.0. Other vb projects part of the solution are still targeting 12.0 but gets compiled in dll as part of web vb project.


回答1:


Answer located here solved my problem:

BuildActivity ignores ToolsVersion

For those of us not living inside build templates every day here's the steps that got it working for me:

First find the template associated with your build (if you already know where to find it skip a couple steps).

Just right click the build definition and select Edit build definition Select the Process tab and you'll see the name of the template (quite likely to be DefaultTemplate if you haven't customized it). On the far right click Show details to see the path for the template.

Go to the Home tab under Team explorer and click Source control explorer

Find the template file and double click to edit it. It should come up in a graphical view like this. Scroll till you find Run MSBuild for Project

Click on this item which will immediately bring up properties

Click on the little icon on the right - don't try and type it in because it'll probably explode and crash Visual Studio. Enter IN QUOTES the following "C:\Program Files (x86)\MSBuild\14.0\bin"

NOW FOR THE MOST IMPORTANT PART

For me the Run MSBuild for Project was in TWO places.

So I just repeated the above steps in both places, and then after I checked in the .xaml file my build FINALLY worked fine.

You may need to recycle the agent / controller from within the TFS tool.




回答2:


when i check in my code, the build server throws an error, seems you are using a CI build. You could also give a try with manually queue the build. And build your code in local to narrow down if it's related to your TFS environment or not.

Also take a look at event view in the build agent/server, if there are some useful info.

Error BC30037: Character is not valid without TFxxxx may related to your code or syntax.

  • Check to see if an extra character has accidentally been inserted into the programming element.
  • Check that the programming element is spelled or constructed using only characters that are valid for that kind of element

Character is not valid



来源:https://stackoverflow.com/questions/44381000/tfs-build-server-string-interpolation-character-is-not-valid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!