sixeyed / docker-on-windows

Code samples for the book "Docker on Windows"
https://www.amazon.com/gp/product/1789617375/
Apache License 2.0
228 stars 124 forks source link

Running docker build on ch03-iis-healthcheck results in build failure at step 6/16 #4

Closed GrahamDSmith closed 5 years ago

GrahamDSmith commented 6 years ago

Output is:

Step 6/16 : RUN msbuild Healthcheck.WebApi.csproj /p:OutputPath=c:\out\Healthcheck /p:DeployOnBuild=true /p:VSToolsPath=C:\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3\tools\VSToolsPath ---> Running in 82394ec8732a Microsoft (R) Build Engine version 15.1.1012.6693 Copyright (C) Microsoft Corporation. All rights reserved.

Build started 12/16/2017 5:35:27 PM. Project "C:\src\Healthcheck.WebApi\Healthcheck.WebApi.csproj" on node 1 (default targets). C:\src\Healthcheck.WebApi\Healthcheck.WebApi.csproj(139,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props. Done Building Project "C:\src\Healthcheck.WebApi\Healthcheck.WebApi.csproj" (default targets) -- FAILED.

Build FAILED.

I've done some research but not got to the bottom of this yet, however this StackOverflow question seems to be related. I can't get the source code to compile locally because of this error but possibly due to not having the right VS2017 components installed. I've run out of time tonight but wanted to get this logged. Cheers!

galkzaz commented 6 years ago

same for me what I did is opening the project using visual studio 2017 then install this 2 packages using NuGet

and the project work on host then build the image again and it works

you can replace packages.config with this content and build image directly

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
  <package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
</packages>
ysudhakar commented 6 years ago

Thank you. above steps resolved build issue. added the two missing packages to packages.json.

sixeyed commented 5 years ago

Fixed in the Second Edition :)