Error Building on Microsoft Container mcr.microsoft.com/dotnet/core/sdk
DarwinJS opened this issue · 2 comments
This line from build.sh returns the value of the net framework twice.
local targetFramework=$(awk -F: '/<TargetFramework(s)?>.netcoreapp[1-9].[0-9].</TargetFramework(s)?>/ { print $0 }' $file | sed 's/.(netcoreapp[1-9].[0-9])./\1/')
Tested adding ' | tail -1' and it builds successfully.
Reproduction steps:
docker run -it mcr.microsoft.com/dotnet/core/sdk:2.1 bash
git clone https://github.com/microsoft/dotnet-apiport.git
cd dotnet-apiport
./build.sh
Get the output (Notice duplication: "Building for: netcoreapp2.1 netcoreapp2.1")
Building ApiPort... Configuration: [Debug]
Building for: netcoreapp2.1 netcoreapp2.1
Microsoft (R) Build Engine version 16.0.450+ga8dc7f1d34 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1008: Only one project can be specified.
Switch: netcoreapp2.1
For switch syntax, type "MSBuild -help"
@DarwinJS Thanks for reporting the issue and committed a PR. However, I couldn't repro the problem. Did you try to run build.cmd file in the same directory, which call the build.sh file with specified parameters. The overall goal is using build.cmd one command to download APICatalog.bin, build product binaries and run tests.
@Lxiamail - thanks for your response.
I wanted to run the analyzer on .NET core on linux - this is why I used the Microsoft .NET Core SDK container that runs linux.
AFAIK .CMD files will not run on this container because it is Linux. Also the linux specific instructions only call for the .sh file: https://github.com/microsoft/dotnet-apiport#linuxmac
You were unable to reproduce on the specific container I used?
I got a different error at first and so I quoted the arguments- then it showed it was doubling up the text.
The sed lines look for both TargetFramework and TargetFrameworks which are both in the file which results in the string netcoreapp2.1 being returned twice.
My proposed fix will work whether the sed lines find one or multiple matches - so will not introduce problems outside the intended scope.