1

I am trying to add Docker support to an ASP.NET MVC (4.6.1) + Anuglar app (Version 11) but getting build error Error: Value cannot be null Parameter name: path2.

If I force run the code despite the build error, got this error

Unable to start debugging on the web server. Invalid URI: The hostname could not be parsed.

FROM mcr.microsoft.com/dotnet/framework/aspnet:4.6.2
ARG source
WORKDIR /inetpub/wwwroot

EXPOSE 80
EXPOSE 443

#install node js
RUN curl -sL https://deb.nodesource.com/setup_8.3.x |  bash -
RUN apt-get install -y nodejs

# copy csproj and restore as distinct layers
COPY ./*.csproj .

# copy everything else and build app
COPY . .
WORKDIR /build
RUN msbuild publish -c release -o published --no-cache

COPY ${source:-obj/Docker/publish} .

ENTRYPOINT ["dotnet", "MyWebApp.Web.dll"]

Below config in my csproj

<Target Name="NpmInstall" Inputs="$(ProjectDir)AA-Crew-LastLiveLeg-Web/package.json" Outputs="node_modules/.install-stamp">
  
    <Exec Command="npm ci" WorkingDirectory="$(ProjectDir)MyWebApp-Web" Condition="$(RestorePackagesWithLockFile) == 'true'" />
    <Exec Command="npm install" WorkingDirectory="$(ProjectDir)MyWebApp-Web" Condition="$(RestorePackagesWithLockFile) != 'true'" />
    <!-- Write the stamp file, so incremental builds work -->
    <!-- <Touch Files="node_modules/.install-stamp" AlwaysCreate="true" /> -->
  </Target>


  <Target Name="RemoveAngularOutput" BeforeTargets="BeforeBuild" Condition="'$(Configuration)' == 'Debug'">
    <RemoveDir Directories="$(ProjectDir)bundles" />
  </Target>
  <Target Name="NgDebug" DependsOnTargets="NpmInstall" BeforeTargets="BeforeBuild" Condition="'$(Configuration)' == 'Debug'">
    <Exec WorkingDirectory="$(ProjectDir)MyWebApp-Web" Command="npm run build" />
  </Target>
  <Target Name="NgRelease" DependsOnTargets="NpmInstall" BeforeTargets="BeforeBuild" Condition="'$(Configuration)' == 'Release'">
    <Exec WorkingDirectory="$(ProjectDir)MyWebApp-Web" Command="npm run build-prod" />
  </Target>

The application work normally without docker support and without build issues. Please advise what am I missing

Dilip
  • 474
  • 2
  • 8
  • 18

0 Answers0