JetBrains / teamcity-dotnet-plugin

TeamCity plugin for .NET projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dotnet build with binlog and multiple csproj files

nazgul72 opened this issue · comments

When executing dotnet build, mulitple csproj files can be specified.

The runner then issue one dotnet build command for each csproj file.

We are in with of using the -binaryLogger parameter, however it only allows a fixed name. Microsoft documentation on the binlogger states that it will write the binlog to current working directory if not otherwise specified

So in this case the only binlog that will exist is the binlog for the latest csproj file in the list.

Is there something that can be done to use the current item in csproj list as the name for the logger? Or other workaround?

@nazgul72 , hello!

dotnet build natively doesn't allow specifying multiple .csproj files. If you try to do that, you get error MSB1008: Only one project can be specified..

When you do so in the .NET runner via the build command, the TeamCity agent generates a series of dotnet build commands with almost the same command line arguments – only the target paths (to .csproj) are different.

So, if you specify a binary log parameter, e.g., -bl:/some/path/to/1.binlog in the command line parameters text field on the .NET runner page, it will be the same for all .csproj, you are right. Unfortunately, there is no way to vary command line parameters along a single build step.

If you need to specify different command line parameters for every particular .csproj target, I'd suggest splitting the build step into several .NET build steps with a single .csproj target set for each.

An another option could be union of the several .csproj into single .sln and running the build command with specified .binlog file against .sln. Thus you will get a single .binlog for all projects in the solution.

Hi

We can't use the sln file, as we use the runtime identifier actively.

Our current workaround is to replace dotnet build step with a custom one and everything works like a charm

I understand that this is an edge case, and don't assume it will be changed, I was just wondering if I missed something.