JetBrains / teamcity-dotnet-plugin

TeamCity plugin for .NET projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem parsing .rsp with .NET SDK 6.0.301

rokleM opened this issue · comments

When I try to start a build I get this:

dotnet restore
Starting: .NET SDK 6.0.301 "C:\Program Files\dotnet\dotnet.exe" restore B:\BuildAgents\work\d1489dc070d6d243\MSBuildTasks.sln --source https://api.nuget.org/v3/index.json --source https://localhost:8111/httpAuth/app/nuget/feed/_Root/default/v2 @b:\BuildAgents\BuildAgent3\temp\agentTmp\1.rsp
in directory: B:\BuildAgents\work\d1489dc070d6d243
MSBUILD : error MSB1006: Property is not valid.
Switch: B:\BuildAgents\BuildAgent3\plugins\dotnet\tools\vstest15
For switch syntax, type "MSBuild -help"
Process exited with code 1

This started happening once I updated BuildTools to 17.2.4, which includes said SDK.

+1 on this, I've also just updated to latest version of .net 6 (6.0.301) and have started seeing this issue in Linux/Debian:

[21:28:18]E: Step 1/14: Publish (.NET)
[21:28:18]i:     [Step 1/14] dotnet --version
[21:28:18]i:     [Step 1/14] Starting:  Getting the .NET SDK version /usr/share/dotnet/ dotnet  --version
[21:28:18]i:     [Step 1/14] in directory:  /opt/teamcity-agent-1/work/eddc24f5d5a9ddc4
[21:28:18]i:     [Step 1/14] 6.0.301
[21:28:18]i:     [Step 1/14] Process exited with code 0
[21:28:18]E:     [Step 1/14] dotnet publish
[21:28:18] :         [dotnet publish] Starting:  [30;1m.NET SDK 6.0.301  [0m/usr/share/dotnet/dotnet publish /opt/teamcity-agent-1/work/eddc24f5d5a9ddc4/Src/XXXXX.sln --configuration Release --output output/ @/opt/teamcity-agent-1/temp/agentTmp/1.rsp -p:PackageVersion=1.0.1767 -p:OutputPath=output/ -p:PublishDir=output/
[21:28:18] :         [dotnet publish] in directory: /opt/teamcity-agent-1/work/eddc24f5d5a9ddc4
[21:28:18] :         [dotnet publish] Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
[21:28:18] :         [dotnet publish] Copyright (C) Microsoft Corporation. All rights reserved.
[21:28:18] :         [dotnet publish] 
[21:28:18] :         [dotnet publish] MSBUILD : error MSB1006: Property is not valid.
[21:28:18] :         [dotnet publish] Switch: /opt/teamcity-agent-1/plugins/dotnet/tools/vstest15
[21:28:18] :         [dotnet publish] 
[21:28:18] :         [dotnet publish] For switch syntax, type "MSBuild -help"
[21:28:18]W:         [dotnet publish] Process exited with code 1
[21:28:18]E:         [dotnet publish] Process exited with code 1 (Step: Publish (.NET))

When looking at /opt/teamcity-agent-1/temp/agentTmp/1.rsp I can see the following line:

-p:VSTestTestAdapterPath=".;/opt/teamcity-agent-1/plugins/dotnet/tools/vstest15"

When I modify it to the below:

-p:VSTestTestAdapterPath="/opt/teamcity-agent-1/plugins/dotnet/tools/vstest15"

And then run the same command via bash, it works ok, but next time I run a build on TeamCity the 1.rsp file re-generates and the same problem occurs.

This seems to have been reported to the main dotnet sdk repo dotnet/sdk#26026

Could you please uprade the .NET plugin for TeamCity 2022

That's worked @NikolayPianikov - many thanks!

Could you please uprade the .NET plugin for TeamCity 2022

Thanks, but even with this update the build fails when the build configuration name contains a comma.

-p:teamcity_buildConfName="Linux, DebugMode off"

error:

[dotnet build] MSBUILD : error MSB1006: Property is not valid.
[dotnet build] Switch: DebugMode off)

NikolayPianikov We use sentinelOne, and after installing the ".NET plugin" you mentioned, sentinelOne classifies it as ransomware due to its behaviour. Is this something you can comment on?

@SRYER What program did this classification? .NET plugin doesn't have such feature

@loop-evgeny please try this plugin

That works with a comma in the build configuration name, thanks! It's URL-encoded in the 1.rsp file now:

-p:teamcity_buildConfName="engine (Linux%2C DebugMode off)"

@loop-evgeny please try this plugin

We are currently on TeamCity 2020.2.4. Would the above plugin work for it or could you post a version for TC 2020.2? Thanks.

commented

As a workaround, currently I add a global.json file in my solution to specify a particular .NET SDK version other than 6.0.301, then everything works again. The global.json file can be removed after this issue gets solved.

A hint to the readers of this issue (which I missed first): the global.json does not need to be in the working/solution directory. You can also just place a global.json in your drive-root so that all builds on your server use this SDK version. This way we avoided updating all of our repositories and branches.

I've tried the new plugin but I'm having issues with multiple Nuget package sources. I tried to URL encode the semicolon separator but it looks like Team City parses the list and replaces my URL encoded semicolons with regular semicolons. Any workarounds for that or should I just force to SDK 6.0.300 instead?

@schwede what command are you using?

restore
I tried to provide --source commands directly in the command line arguments to workaround it but I can't clear what's put in the package sources in the rsp file. There must be some kind of inherited behavior in my build because I get the same text in "-p:PackageSources" no matter what I put in "NuGet package sources".

I'm getting the same issue with .NET restore, I pass in a Nuget.config file and get an error with the urls being passed as switches.

[dotnet restore] MSBUILD : error MSB1006: Property is not valid.
[dotnet restore] Switch: https://xxxxxxx/guestAuth/app/nuget/v1/FeedService.svc/

@NikolayPianikov Can you explain how to install the plugin please?

@NikolayPianikov Can you explain how to install the plugin please?

Administration -> Plugins -> [Upload plugin zip]

Then restart server as prompted.

same issue here. about to install TeamCity upgrade. I am hoping this does not cause further issues. All of our builds broke using 6.0.300

It looks like the root cause in dotnet/sdk#26026 is fixed as of .NET 6.0.303. I installed the latest version of .NET (6.0.400) and deleted my global.json workaround -- everything's working as expected now.