labs icon indicating copy to clipboard operation
labs copied to clipboard

The MusicStore sample app does not build

Open sheng-liang opened this issue 9 years ago • 24 comments

The docker-compose -f .\docker-compose.windows.yml build command fails. It happens for me on both Docker for Windows beta (1.13.0-rc4) and the standard 1.12.2 Docker on Windows Server 2016.

Step 10/13 : RUN dotnet build .\samples\MusicStore.Standalone
 ---> Running in 757c95651249
Project MusicStore.Standalone (.NETCoreApp,Version=v1.1) will be compiled because expected outputs are missing
Compiling MusicStore.Standalone for .NETCoreApp,Version=v1.1
C:\Program Files\dotnet\dotnet.exe compile-csc @C:\MusicStore\samples\MusicStore.Standalone\obj\Debug\netcoreapp1.1\dotn
et-compile.rsp returned Exit Code 1
C:\MusicStore\samples\MusicStore\MessageServices.cs(7,23): error CS0433: The type 'Task' exists in both 'System.Threadin
g.Tasks, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime, Version=4.2.0.0, Cultu
re=neutral, PublicKeyToken=b03f5f7f11d50a3a'
C:\MusicStore\samples\MusicStore\MessageServices.cs(13,23): error CS0433: The type 'Task' exists in both 'System.Threadi
ng.Tasks, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime, Version=4.2.0.0, Cult
ure=neutral, PublicKeyToken=b03f5f7f11d50a3a'
C:\MusicStore\samples\MusicStore\Controllers\AccountController.cs(49,42): error CS1983: The return type of an async meth
od must be void, Task or Task<T>
C:\MusicStore\samples\MusicStore\Controllers\AccountController.cs(49,22): error CS0433: The type 'Task<TResult>' exists
in both 'System.Threading.Tasks, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime
, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
C:\MusicStore\samples\MusicStore\Controllers\AccountController.cs(83,41): error CS1983: The return type of an async meth
od must be void, Task or Task<T>
C:\MusicStore\samples\MusicStore\Controllers\AccountController.cs(83,22): error CS0433: The type 'Task<TResult>' exists
in both 'System.Threading.Tasks, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime
, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
C:\MusicStore\samples\MusicStore\Controllers\AccountController.cs(106,41): error CS1983: The return type of an async met
hod must be void, Task or Task<T>

sheng-liang avatar Dec 28 '16 18:12 sheng-liang

Same here :|

frjaraur avatar Jan 02 '17 15:01 frjaraur

Getting the same annoying error

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0433	The type 'Task' exists in both 'System.Threading.Tasks, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'	Fairies.Web..NETCoreApp,Version=v1.1	

Seems that is issue has been going on for a while and the netcore to NETStandard mappings are messed up -

Discussion about this here https://github.com/dotnet/corefx/issues/14203

jsoveral avatar Jan 03 '17 16:01 jsoveral

PS C:\Users\Administrator\Downloads\MusicStore> docker build -t web -f .\Dockerfile.windows . Sending build context to Docker daemon 2.558 MB Step 1/13 : FROM microsoft/dotnet:nanoserver ---> e4d55b5b2ddc Step 2/13 : SHELL powershell -Command $ErrorActionPreference = 'Stop'; ---> Using cache ---> 093e75409771 Step 3/13 : RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord ---> Using cache ---> 0d430c7670b7 Step 4/13 : RUN New-Item -Path \MusicStore\samples\MusicStore.Standalone -Type Directory ---> Using cache ---> 81fd4d80bd2c Step 5/13 : WORKDIR MusicStore ---> Using cache ---> 9e0774ff4c51 Step 6/13 : ADD samples/MusicStore.Standalone/project.json samples/MusicStore.Standalone/project.json ---> Using cache ---> 2f42d1df9e07 Step 7/13 : ADD NuGet.config . ---> Using cache ---> 57c83bf9b191 Step 8/13 : RUN dotnet restore .\samples\MusicStore.Standalone ---> Using cache ---> 2e584c1d9811 Step 9/13 : ADD samples samples ---> Using cache ---> 60b9e9b2c71c Step 10/13 : RUN dotnet build .\samples\MusicStore.Standalone ---> Running in 7d403cc141e1 Project MusicStore.Standalone (.NETCoreApp,Version=v1.1) will be compiled because expected outputs are missing Compiling MusicStore.Standalone for .NETCoreApp,Version=v1.1 C:\Program Files\dotnet\dotnet.exe compile-csc @C:\MusicStore\samples\MusicStore.Standalone\obj\Debug\netcoreapp1.1\dotnet-compile.rsp returned Exit Code 1 C:\MusicStore\samples\MusicStore\Controllers\AccountController.cs(49,42): error CS1983: The return type of an async method must be void, Task or Task C:\MusicStore\samples\MusicStore\Controllers\AccountController.cs(49,22): error CS0433: The type 'Task' exists in both 'System.Threading.Tasks, Version=4.0.10.0, Culture=neutral, PublicKey Token=b03f5f7f11d50a3a' and 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' C:\MusicStore\samples\MusicStore\Controllers\AccountController.cs(83,41): error CS1983: The return type of an async method must be void, Task or Task C:\MusicStore\samples\MusicStore\Controllers\AccountController.cs(83,22): error CS0433: The type 'Task' exists in both 'System.Threading.Tasks, Version=4.0.10.0, Culture=neutral, PublicKey Token=b03f5f7f11d50a3a' and 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' C:\MusicStore\samples\MusicStore\Controllers\AccountController.cs(106,41): error CS1983: The return type of an async method must be void, Task or Task C:\MusicStore\samples\MusicStore\Controllers\AccountController.cs(106,22): error CS0433: The type 'Task' exists in both 'System.Threading.Tasks, Version=4.0.10.0, Culture=neutral, PublicKe yToken=b03f5f7f11d50a3a' and 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

........... ........... ........... ........... ........... ...........

Compilation failed. 0 Warning(s) 159 Error(s)

Time elapsed 00:00:04.8859879

The command 'powershell -Command $ErrorActionPreference = 'Stop'; dotnet build .\samples\MusicStore.Standalone' returned a non-zero code: 1

frjaraur avatar Jan 04 '17 12:01 frjaraur

The work around that I found is to revert the version of the NETCoreApp:

"dependencies": { "Microsoft.NETCore.App": { "version": "1.0.3", "type": "platform" } }

1.0.3 works for me

jsoveral avatar Jan 04 '17 12:01 jsoveral

Thanks jsoveral. Where do I have to change that version info?

frjaraur avatar Jan 04 '17 17:01 frjaraur

I see near-matches in the project.json files under /samples, but changing the values to 1.0.3 didn't get me there...

brycem avatar Jan 06 '17 02:01 brycem

I found 4 project.json files in the solution:

\Musicstore\samples\MusicStore.Standalone\project.json
\Musicstore\samples\MusicStore\project.json
\Musicstore\test\E2ETests\project.json
\Musicstore\test\MusicStore.Test\project.json

I changed version to 1.0.3 in all of them, as suggested by @jsoveral:

        "Microsoft.NETCore.App": {
          "version": "1.0.3"
        }

Even so, when trying to rebuild the error message is the same. Any ideas on how to workaround this error?

jfoliveira avatar Jan 16 '17 10:01 jfoliveira

Sorry guys, I updated my code now: https://github.com/friism/MusicStore

Also updated the PR to Microsoft: https://github.com/aspnet/MusicStore/pull/736

friism avatar Jan 24 '17 04:01 friism

@sixeyed @ManoMarks can you check if this works on your machines? If yes, pls. close

friism avatar Jan 24 '17 19:01 friism

error2

I got some new errors! /Mats

easec avatar Jan 25 '17 10:01 easec

I had the same error, @easec. Updating docker-compose to 1.10.0 fixed it.

JanneRantala avatar Jan 25 '17 10:01 JanneRantala

Ok! I was checking for that! Thanks! /Mats

easec avatar Jan 25 '17 10:01 easec

However now when I'm running app it complains that Login failed for user 'sa'. Are you getting the same?

JanneRantala avatar Jan 25 '17 10:01 JanneRantala

I´m stuck with upgading docker-compose, how did you do that? /Mats

easec avatar Jan 25 '17 10:01 easec

I'm using Chocolatey, choco install docker-compose.

JanneRantala avatar Jan 25 '17 10:01 JanneRantala

Ok, I did not! /Mats

easec avatar Jan 25 '17 11:01 easec

@friism Tried your repo and it worked out of the box with docker-compose 1.10, docker 1.13.0 on a Win2016 machine.

StefanScherer avatar Jan 25 '17 13:01 StefanScherer

error3

I got a lot of errors! /Mats

easec avatar Jan 25 '17 20:01 easec

I have to stop and restart couple of times, now it´s working! work

easec avatar Jan 25 '17 20:01 easec

Strange, I also had to restart several times and finally got rid of that login failed for user sa -error. And I thought Docker was supposed to help us get rid of "works on my machine" :)

JanneRantala avatar Jan 26 '17 08:01 JanneRantala