JetBrains / teamcity-dotnet-plugin

TeamCity plugin for .NET projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Property is not valid" error caused by invalid values in rsp file

brainmeyers opened this issue · comments

I am having the same problem as Issue 85

I am using the latest version of Team City [2022.04.1 (build 108575)] and the latest version of .net 6 SDK (6.0.301) so I am not sure why previous fixes are not working in my case.

I get the same "Property is not valid" error. Here is the errors from the log file:

[14:06:48][dotnet build] Starting: .NET SDK 6.0.301 "C:\Program Files\dotnet\dotnet.exe" build E:\TeamCity\BuildAgent3\work\d35fb6d8451a3848\BackOffice\src\BackOffice.sln --configuration release @E:\TeamCity\BuildAgent3\temp\agentTmp\1.rsp -p:Version=7.2207.75.0
[14:06:48][dotnet build] in directory: E:\TeamCity\BuildAgent3\work\d35fb6d8451a3848
[14:06:49][dotnet build] Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
[14:06:49][dotnet build] Copyright (C) Microsoft Corporation. All rights reserved.
[14:06:49][dotnet build] 
[14:06:49][dotnet build] MSBUILD : error MSB1006: Property is not valid.
[14:06:49][dotnet build] Switch: E:\TeamCity\BuildAgent3\plugins\dotnet\tools\vstest15
[14:06:49][dotnet build] 
[14:06:49][dotnet build] For switch syntax, type "MSBuild -help"
[14:06:49][dotnet build] Process exited with code 1
[14:06:49][dotnet build] Process exited with code 1 (Step: Compile (.NET))

I get the same error if I run the command manually on the server.

The property with the problem is this one:

  • -p:VSTestTestAdapterPath=".;E:\TeamCity\BuildAgent2\plugins\dotnet\tools\vstest15"

If I remove that property, it also complains about the common in these two properties:

  • -p:Company="MyCompany, LLC"
  • -p:Copyright="Copyright 2007-2022 MyCompany, LLC"

If I remove all three properties then the build is successful.

Here is the full contents of my rsp file that is generated by the plug in.

/noconsolelogger
"/l:TeamCity.MSBuild.Logger.TeamCityMSBuildLogger,E:\TeamCity\BuildAgent2\plugins\dotnet\tools\msbuild15\TeamCity.MSBuild.Logger.dll;TeamCity;plain"
/nodeReuse:false
-p:VSTestLogger=logger://teamcity
-p:VSTestTestAdapterPath=".;E:\TeamCity\BuildAgent2\plugins\dotnet\tools\vstest15"
-p:VSTestVerbosity=normal
-p:Company="MyCompany, LLC"
-p:Copyright="Copyright 2007-2022 MyCompany, LLC"
-p:FxCopCmdFileVersion=17.0.32408.312
-p:FxCopRoot="C:\Program Files\Microsoft Visual Studio\2022\Professional\Team Tools\Static Analysis Tools\FxCop"
-p:Product=MyProduct
-p:Version=7.2207.66.0
-p:agent_home_dir=E:\TeamCity\BuildAgent2
-p:agent_name=myserver-2
-p:agent_work_dir=E:\TeamCity\BuildAgent2\work
-p:build_number=7.2207.66.0
-p:build_vcs_number=91bae018adea7de834d12a2984d4a0e8d7949f23
-p:build_vcs_number_1=91bae018adea7de834d12a2984d4a0e8d7949f23
-p:build_vcs_number_MarketRisk=91bae018adea7de834d12a2984d4a0e8d7949f23
-p:java_io_tmpdir=E:\TeamCity\BuildAgent2\temp\buildTmp
-p:teamcity_agent_cpuBenchmark=701
-p:teamcity_agent_dotnet_agent_url=http://localhost:9092/RPC2
-p:teamcity_agent_dotnet_build_id=94542
-p:teamcity_auth_password=huyPY7F88R5FZy1gixKxSaC3BMnR0JMn
-p:teamcity_auth_userId=TeamCityBuildId=94542
-p:teamcity_build_changedFiles_file=E:\TeamCity\BuildAgent2\temp\buildTmp\changedFiles13551652186946832154.txt
-p:teamcity_build_checkoutDir=E:\TeamCity\BuildAgent2\work\e699bff09e84026e
-p:teamcity_build_properties_file=E:\TeamCity\BuildAgent2\temp\buildTmp\teamcity.build14952762054516357846.properties
-p:teamcity_build_tempDir=E:\TeamCity\BuildAgent2\temp\buildTmp
-p:teamcity_build_workingDir=E:\TeamCity\BuildAgent2\work\e699bff09e84026e
-p:teamcity_buildConfName="Market Risk"
-p:teamcity_buildType_id=MarketRisk
-p:teamcity_configuration_properties_file=E:\TeamCity\BuildAgent2\temp\buildTmp\teamcity.config14620525786986346717.properties
-p:teamcity_dotnet_nunitaddin=E:\TeamCity\BuildAgent2\plugins\dotnetPlugin\bin\JetBrains.TeamCity.NUnitAddin-NUnit
-p:teamcity_dotnet_nunitlauncher=E:\TeamCity\BuildAgent2\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe
-p:teamcity_dotnet_nunitlauncher_msbuild_task=E:\TeamCity\BuildAgent2\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MSBuildLoggers.dll
-p:teamcity_dotnet_nunitlauncher1_1=E:\TeamCity\BuildAgent2\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher1.1.exe
-p:teamcity_dotnet_nunitlauncher2_0=E:\TeamCity\BuildAgent2\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.exe
-p:teamcity_dotnet_nunitlauncher2_0_vsts=E:\TeamCity\BuildAgent2\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.VSTS.exe
-p:teamcity_dotnet_platform=E:\TeamCity\BuildAgent2\plugins\dotnetPlugin\bin\JetBrains.TeamCity.PlatformProcessRunner.1.1.exe
... // A few others that were not relevant.
-p:teamcity_runner_properties_file=E:\TeamCity\BuildAgent2\temp\buildTmp\teamcity.runner3768283398225612084.properties
-p:teamcity_tests_recentlyFailedTests_file=E:\TeamCity\BuildAgent2\temp\buildTmp\testsToRunFirst1157672091888223247.txt
-p:teamcity_version="2022.04.1 (build 108575)"

I could probably get by with removing the comma in the Company and Copyright properties, but VSTestTestAdapterPath appears to be something generated by the plugin.

I do believe it was working at one time, but I recently installed VS 2022 on the build server and that may or may not have contributed to the problem.

Please let me know if there is any other information that may be useful in resolving this issue.

I don't know why I spent the whole day researching the problem only to find this similar issue right after I created one:

#158

It may solve my problem. I will try the solution and revert back.

The solution from #158 did in fact resolve my problem with the p:VSTestTestAdapterPath property.

It did not resolve my error with these two custom parameters

-p:Company="MyCompany, LLC"
-p:Copyright="Copyright 2007-2022 MyCompany, LLC"

I get the same error, but now related to the Company property

[14:06:49][dotnet build] MSBUILD : error MSB1006: Property is not valid.
[14:06:49][dotnet build] Switch: LLC

It is an easy solution for me to remove the comma from my property value. So this isn't stopping me anymore. But it may be something to consider improving in a future version.

Hi,
I have a similiar error with dotnet test step in teamcity. Throwing many errors because of rsp file. I'm using latest TeamCity Build with dotnet 7 sdk

It gives me german error messages but it means "Command or Argument ... not recognized

`10:31:09 Starting: .NET SDK 7.0.100 "C:\Program Files\dotnet\dotnet.exe" test C:\TeamCity\buildAgent\work\be4e52c3f84f0214\3SS\M\Tests\IntegrationTests\IntegrationTests.csproj @C:\TeamCity\buildAgent\temp\agentTmp\3.rsp
10:31:09 in directory: C:\TeamCity\buildAgent\work\be4e52c3f84f0214

Befehl oder Argument "/noconsolelogger" nicht erkannt
09:17:32 Befehl oder Argument ""/l:TeamCity.MSBuild.Logger.TeamCityMSBuildLogger,C:\TeamCity\buildAgent\plugins\dotnet\tools\msbuild15\TeamCity.MSBuild.Logger.dll;TeamCity;verbosity=normal;plain"" nicht erkannt
09:17:32 Befehl oder Argument "/nodeReuse:false" nicht erkannt
09:17:32 Befehl oder Argument "-p:VSTestLogger=logger://teamcity" nicht erkannt
09:17:32 Befehl oder Argument "-p:VSTestTestAdapterPath=".%3BC:\TeamCity\buildAgent\plugins\dotnet\tools\vstest15"" nicht erkannt
09:17:32 Befehl oder Argument "-p:VSTestVerbosity=normal" nicht erkannt
09:17:32 Befehl oder Argument "-p:agent_home_dir=C:\TeamCity\buildAgent" nicht erkannt
09:17:32 Befehl oder Argument "-p:agent_name=dev-ci2" nicht erkannt
09:17:32 Befehl oder Argument "-p:agent_work_dir=C:\TeamCity\buildAgent\work" nicht erkannt`

EDIT: It seems that with dotnet 7 the msbuild parameters are passed differently at the moment. microsoft/vstest#4014

Hi @danreg,

We have related issue in our YouTrack. The issue related to the bug introduced in .NET SDK 7.0.100. I have already created the corresponding issue to .NET team: dotnet/sdk#28975. We are waiting the fix from their side.

Please, check comments on YouTrack for a possible workaround for you problem and do not hesitate to ask us there.

Long story short, to perform dotnet test command via .NET support plugin for TeamCity on .NET SDK 7.0.100 you need the following:

  • switch language of dotnet CLI by passing env variable DOTNET_CLI_UI_LANGUAGE with value en
  • pass the following additional env variables (you could find more details here)
  • VSTestTestAdapterPath equals to %teamcity.agent.home.dir%/plugins/dotnet/tools/vstest15
  • VSTestLogger equals to logger://teamcity
  • VSTestVerbosity equals to normal

@mchechulnikov awesome this works!!! I've spent so much time on googling and trying to find exactly this :)