0

I am currently trying to get an ASP.NET Core 1.1 testproject to build within the microsoft/aspnetcore-build:1.1.0-msbuild docker image.

I am running Docker on Windows 10 Pro 64 and have the newest CLI/SDK (1.0.0-preview4-004233) installed. And I think there lies the problem. The current image uses (1.0.0-preview3-004056) and throws an error "error MSB4057: The target Restore does not exist in the project." when I execute "dotnet restore" within the running container in interactive mode.

My question is: Is it the version mismatch that creates the error or am I missing something? My guess is that it has to do with some msbuild specific changes between preview3 and preview4. Can I build my own docker image that uses the right SDK version? Links to good tutorials are very appreciated.

Steps to replicate:

  • Install the newest 1.1 SDK
  • Open Powershell and navigate in an new and empty project folder
  • Validate that you have preview4 "dotnet --info"
  • Create new project "dotnet new -t Web"
  • Open the *.csproj file change netcoreapp1.0 to netcoreapp1.1 and Microsoft.NETCore.App Version to "1.1.0".
  • Restore packages "dotnet restore"
  • Test with "dotnet run"
  • Start docker-container in interactive mode docker run -it --rm -v "$pwd:/sln" --workdir /sln microsoft/aspnetcore-build:1.1.0-msbuild
  • Within the running container use "dotnet restore" to force the error

Cheers Martin

1 Answer 1

1

Tooling is still in preview, and there are huge movements about xproj/csproj project file format. So it's very probable that differences between preview3 and preview4 are critical for your project.

Install appropriate (preview3) CLI to your computer.

There is no user-friendly listing of al versions on MS site, but in docker image you can see download location like this:

https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-dev-debian-x64.$DOTNET_SDK_VERSION.tar.gz

Replace variables with desired values: 1.0.0-preview3-004056 and dotnet-dev-win-x64.1.0.0-preview3-004056.exe (second is guess using up-to-date file names from download page).

Now you need to set you app to use appropriate tooling version (now you have two installed). Create global.json file with:

{
  "sdk": {
    "version": "1.0.0-preview3-004056"
  }
}

To verify: running dotnet --version from solution dir (or below) will print 1.0.0-preview3-004056, while running from any other folder will print 1.0.0-preview4-004233

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.