net451 - Failed to make the following project runnable
Description
I have ported an open-source .Net library MaxMind.Db-Reader to .Net Core. There are three projects in the solution:
- MaxMind.Db - Library
- MaxMind.Db.Benchmark - Executable
- MaxMind.Db.Test - Executable
URL to .Net Core port branch: https://github.com/am11/MaxMind-DB-Reader-dotnet/tree/coreclr-port
Locally, with RID: win10-x86, I have latest DNX and latest CLI (5 hours old) installed; all three projects compile, Benchmark and Test executables run for two TFMs: netstandard1.0 and net451.
When deployed to AppVeyor CI (see appveyor.yml; modified variant of @enricosada's script: dotnet/sdk#5496), it builds all three project with netstandard1.4 for lib and netcoreapp1.0 for exes, but the exe (Benchmark and Test projects) build fails for net451.
Here is the AppVeyor build log: https://ci.appveyor.com/project/am11/maxmind-db-reader-dotnet/build/1.0.39/job/7no4jns5isw4mn27#L1245
Steps to reproduce
git clone https://github.com/am11/MaxMind-DB-Reader-dotnet -b coreclr-port --recursive
cd MaxMind-DB-Reader-dotnet
git checkout 22eace3
dotnet restore
dotnet -v build -c Debug -f net451 .\MaxMind.Db.Test
Expected behavior
Successfully compiles a lib and two executable projects for both TFMs: net451 and netcoreapp1.0.
Actual behavior
-
Successfully compiles a lib and two executable projects for TFMs netcoreapp1.0.
-
Successfully compiles a lib for TFM net451.
-
Fails to compile two executable projects for TFM net451 with the following error:
Failed to make the following project runnable
Environment data
dotnet --info output:
.NET Command Line Tools (1.0.0-rc2-002659)
Product Information: Version: 1.0.0-rc2-002659 Commit Sha: 11a001706f
Runtime Environment: OS Name: Windows OS Version: 6.3.9600 OS Platform: Windows RID: win81-x64
@am11 Some changes went in yesterday which should append some more specific information to that error message, is that all the output you see?
@brthor, the CI is showing:
dotnet : Failed to make the following project runnable: MaxMind.Db.Benchmark (.NETFramework,Version=v4.5.1) reason: Could not read assembly info for C:\projects\maxmind-db-reader-dotnet\MaxMind.Db.Benchmark\bin\Debug\net451\win7-x64\MaxMind.Db.Benchmark.exe At line:21 char:1
- dotnet build -c $env:Configuration -f $env:Framework -o ".\MaxMind.Db.Benchmark\ ...
- CategoryInfo : NotSpecified: (Failed to make ...b.Benchmark.exe:String) [], RemoteException - FullyQualifiedErrorId : NativeCommandError
Seems like it is trying to read assembly info at wrong location, although the command is explicitly setting output directory:
# $env:Configuration = "Debug"
# $env:Framework = "net451"
dotnet build -c $env:Configuration -f $env:Framework `
-o ".\MaxMind.Db.Benchmark\bin\$Configuration\$env:Framework" `
.\MaxMind.Db.Benchmark
As per this build command, exe file is correctly generated at:
C:\projects\maxmind-db-reader-dotnet\MaxMind.Db.Benchmark\bin\Debug\net451\MaxMind.Db.Benchmark.exe
but the assembly metadata info reader is searching at:
C:\projects\maxmind-db-reader-dotnet\MaxMind.Db.Benchmark\bin\Debug\net451\win7-x64\MaxMind.Db.Benchmark.exe
with extra win7-x64\ in path.
Could this be the reader bug?
This looks to be happening when it tries to read the AssemblyInfo for Binding Redirects.
@Sridhar-MS is our SME here
@brthor we discussed this issue offline. Let's experiment with -r here.
@am11 can you change your -o path to "someString" so we see what the build command is actually appending?
@piotrpMSFT, with "someString" set for -o like this: https://github.com/am11/MaxMind-DB-Reader-dotnet/commit/c5f92cbc1fc8ac7c72cceb524152c839d6de8f72, the CI output is:
Project MaxMind.Db (.NETFramework,Version=v4.5.1) was previously compiled. Skipping compilation. Project MaxMind.Db.Benchmark (.NETFramework,Version=v4.5.1) will be compiled because expected outputs are missing Compiling MaxMind.Db.Benchmark for .NETFramework,Version=v4.5.1
Compilation succeeded. 0 Warning(s) 0 Error(s)
Time elapsed 00:00:03.1259261 dotnet : Failed to make the following project runnable: MaxMind.Db.Benchmark (.NETFramework,Version=v4.5.1) reason: Could not read assembly info for C:\projects\maxmind-db-reader-dotnet\MaxMind.Db.Benchmark\bin\Debug\net451\win7-x64\MaxMind.Db.Benchmark.exe At line:21 char:1
- dotnet build -c $env:Configuration -f $env:Framework -o "someString" .\MaxMind.D ...
- CategoryInfo : NotSpecified: (Failed to make ...b.Benchmark.exe:String) [], RemoteException - FullyQualifiedErrorId : NativeCommandError
I'm seeing this bug in different project for rc2 final (just converted from rc1), building from within MSVS. Could anyone post a workaround?
@crokusek: did you resolve this?
running into the same issue
It still happens for me every so often. One time I thought the target .exe was there and then another I think it wasn't there at all. Changing permissions on the folder or directory did not help and restarting MSVS would still fail the build. I think a reboot of the machine has cleared it every time. Someone else working on a different machine here has repeated the issue also.
Happening to me as well. -o command option seems to be the problem as stated above. -b option also seems to need some love when using the --no-dependencies flag. My scenario- building my test project without building the main project it is testing. Works just fine when not using the --no-dependencies flag. My hack to work around the -o problem is to build twice. Once not specifying -o, then again using. it. I didn't want to create a copy script for something the tool will eventually do.
Is this still on target to make the release next week? I am still running into it on several occasions.
Still no update? RTM is out and I am still seeing this issue.
@piotrpMSFT: What is the resolution here?
I found my way here because I had the same error (I'm on release version 1.0). Everything has been going fine until I removed a GIT submodule from my solution and then added direct project references to my solution. I immediately started getting the "Failed to make the following project runnable" error. Turns out I still had a .dnx folder. Deleting that fixed it all up.
How come this issue is still not fixed? I am using the stable release and also Microsoft's very own source control system - Team Foundation Server ®. Simply created a default new project against rock-solid .NET 4.5.2.
my issue it was using -o parameter if i provide fullpath including configuration, framework and runtime on output parameter, the error is gone ex:
dotnet build -c Release -o .\bin\Release\net461\win7-x64 -f net461
dotnet build -c Debug -o .\bin\Debug\net461\win7-x64 -f net461
dotnet build -c Debug -o .\bin\Debug\net451\win7-x64 -f net451
still broken as of Preview 2-1-003177. Attempted --output of --framework net462 and received the same error.
@Meyce we're working on preview5 at this point.
This issue has been mitigated with latest 1.0.0-rc4-004767. I tested with following steps:
-
Downloaded https://dotnetcli.blob.core.windows.net/dotnet/Sdk/rel-1.0.0/dotnet-dev-win-x64.latest.zip and extracted at
c:\temp\dotnet-cli. -
Then, we first migrate the project and build the
csproj:cd \temp\dotnet-cli git clone https://github.com/maxmin/Maxmind-DB-Reader-dotnet --recursive cd Maxmind-DB-Reader-dotnet git checkout 822b6c5 :: we have xproj and project.json in this revision :: migration will delete project.json and global.json, convert xproj->csproj and update the :: .sln file accordingly. The process will also create a `.\backup` with old project files. ..\dotnet migrate :: restore and build ..\dotnet restore ..\dotnet build -c Debug -f net45 MaxMind.Db.Benchmark :: succeeds! :: Microsoft (R) Build Engine version 15.1.545.13942 :: Copyright (C) Microsoft Corporation. All rights reserved. :: MaxMind.Db -> C:\temp\foodoo\Maxmind-DB-Reader-dotnet\MaxMind.Db\bin\Debug\net45\MaxMind.Db.dll :: MaxMind.Db.Benchmark -> C:\temp\foodoo\Maxmind-DB-Reader-dotnet\MaxMind.Db.Benchmark\bin\Debug\net45\MaxMind.Db.Benchmark.exe :: Build succeeded. :: 0 Warning(s) :: 0 Error(s) :: Time Elapsed 00:00:02.15 :: let's run it ..\dotnet run -c Debug -f net45 -p .\MaxMind.Db.Benchmark\MaxMind.Db.Benchmark.csproj MaxMind.Db.Benchmark\GeoLite2-City.mmdb :: it works! :)
Thanks and kudo's to CLI team for fixing this! 🎉
/cc @oschwald
@piotrpMSFT, should this issue be closed as fixed?
Thanks for validating, @am11! Closing the issue.