aspnet / MusicStore

[Archived] MusicStore test application that uses ASP.NET/EF Core. Project moved to https://github.com/aspnet/AspNetCore
1.3k stars 878 forks source link

Unable to build Musicstore with latest .net cli #630

Closed sds123 closed 8 years ago

sds123 commented 8 years ago

Hi, I have downloaded the latest .net cli from [https://github.com/dotnet/cli ]() The version of .net cli I am using is 1.0.0-rc2-002306.

Later I navigated to folder src/Musicstore using cmd prompt and executed the below commands

However I see error msg

"Can not find runtime target for framework '.NETStandardApp,Version=v1.5' compatible with one of the target runtimes: 'win81-x64, win8-x64, win7-x64'. Possible causes:
1. The project has not been restored or restore failed - run `dotnet restore`
2. The project does not list one of 'win81-x64, win8-x64, win7-x64' in the 'runtimes' section."

I know , we will have to update the Project.json. Kindly can anyone guide me what changes are supposed to be made to get the same working.

deivisonrpg commented 8 years ago

same error here.

kichalla commented 8 years ago

Please do not use arbitrary CLI versions to build MusicStore. Our build system locks on specific CLI versions which work for ASP.NET. if you are trying to build MusicStore, you can just clone (if you have already cloned, then delete the .build folder which might got generated earlier) and run the build command (build.cmd or build.sh if on non-windows). Try this and let us know if you still see an issue.

sds123 commented 8 years ago

Thank you @kichalla for your response. I followed the steps you mentioned

  1. deleted the .build folder
  2. In cmd , executed build.cmd
  3. Selected option R: Run

I got the below errors

Errors in C:\.....\MusicStore-dev\MusicStore-dev\src\MusicStore\project.json
    Unable to resolve 'Microsoft.AspNetCore.DataProtection (>= 1.0.0-rc3-20533)' for '.NETCoreApp,Version=v1.0'.
    Unable to resolve 'Microsoft.AspNetCore.Http (>= 1.0.0-rc3-20533)' for '.NETCoreApp,Version=v1.0'.
    Unable to resolve 'Microsoft.AspNetCore.Http.Extensions (>= 1.0.0-rc3-20533)' for '.NETCoreApp,Version=v1.0'.
    Unable to resolve 'Microsoft.AspNetCore.Razor.Tools (>= 1.0.0)' for '.NETStandardApp,Version=v1.5'.

Errors in C:\.....\MusicStore-dev\MusicStore-dev\src\MusicStore\project.json
    Unable to resolve 'Microsoft.AspNetCore.DataProtection (>= 1.0.0-rc3-20533)' for '.NETStandardApp,Version=v1.5'.
    Unable to resolve 'Microsoft.AspNetCore.Http (>= 1.0.0-rc3-20533)' for '.NETStandardApp,Version=v1.5'.
    Unable to resolve 'Microsoft.AspNetCore.Http.Extensions (>= 1.0.0-rc3-20533)' for '.NETStandardApp,Version=v1.5'.

Errors in C:\.....\MusicStore-dev\MusicStore-dev\src\MusicStore\project.json
    Unable to resolve 'Microsoft.AspNetCore.DataProtection (>= 1.0.0-rc3-20533)' for '.NETStandardApp,Version=v1.5'.
    Unable to resolve 'Microsoft.AspNetCore.Http (>= 1.0.0-rc3-20533)' for '.NETStandardApp,Version=v1.5'.
    Unable to resolve 'Microsoft.AspNetCore.Http.Extensions (>= 1.0.0-rc3-20533)' for '.NETStandardApp,Version=v1.5'.
    Unable to resolve 'Microsoft.AspNetCore.DataProtection (>= 1.0.0-rc3-20533)' for '.NETFramework,Version=v4.5.1'.
    Unable to resolve 'Microsoft.AspNetCore.Http (>= 1.0.0-rc3-20533)' for '.NETFramework,Version=v4.5.1'.
    Unable to resolve 'Microsoft.AspNetCore.Http.Extensions (>= 1.0.0-rc3-20533)' for '.NETFramework,Version=v4.5.1'.

NuGet Config files used:
    C:\.....MusicStore-dev\MusicStore-dev\NuGet.Config
    C:\Users\.....\AppData\Roaming\NuGet\NuGet.Config

Feeds used:
    https://dotnet.myget.org/F/cli-deps/api/v3/index.json
    https://api.nuget.org/v3/index.json

Kindly let me know , if I am missing on anything

MathiasKowoll commented 8 years ago

You need to add

"runtimes":{ "osx.10.11-x64": {}, "ubuntu.14.04-x64": {}, "win7-x64":{} },

to you project.json

sds123 commented 8 years ago

Thank you @BeelzeBu . Yes , when I run build.cmd , I can compile the application.

My question is , which is the cli version locked for MusicStore ,

All I want to do is, get the exact cli version and run below commands

Update: Got it , cli gets downloaded at c:\Users\.....\AppData\Local\Microsoft\dotnet\

sds123 commented 8 years ago

Hi @BeelzeBu , @kichalla I managed to restore, build , run the server project in src/MusicStore. I have deployed it at "http://localhost:5005/" successfully !!!!!

Now I open project at test/E2Etest. I can restore and build the project successfully. However when I execute command dotnet test , I get error at line 124 var deploymentResult = deployer.Deploy();

Below is error message

xUnit.net Runner (64-bit win81-x64)
  Discovering: E2ETests
  Discovered:  E2ETests
  Starting:    E2ETests
    E2ETests.SmokeTests_X64.WindowsOS(serverType: Kestrel, runtimeFlavor: CoreClr, architecture: x64, applicationBaseUrl: "http://localhost:5005/") [FAIL]
      System.Exception : dotnet publish exited with exit code : 1
      Stack Trace:
           at Microsoft.AspNetCore.Server.Testing.ApplicationDeployer.DotnetPublish(String publishRoot)
           at Microsoft.AspNetCore.Server.Testing.SelfHostDeployer.Deploy()

        C:\.....\MusicStore-dev\test\E2ETests\SmokeTests.cs(124,0): at E2ETests.SmokeTests.<SmokeTestSuite>d__2.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

        C:\.....\MusicStore-dev\test\E2ETests\SmokeTests.cs(39,0): at E2ETests.SmokeTests_X64.<WindowsOS>d__2.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Kindly can you help here

evertmulder commented 8 years ago

I was able to build using dotnet-cli 1.0.0-rc2-002416 using the following project.json

{ "authors": [ "Microsoft" ... "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0-", "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0-" } }, "frameworks": { //"net46": { }, "netcoreapp1.0": { "imports": [ "portable-net45+wp80+win8+wpa81+dnxcore50", "portable-net45+win8+wp8+wpa81", "portable-net45+win8+wp8" ] }
} }

Framework net46 gives an error: error NU1002: The dependency System.Runtime.Loader 4.0.0-rc2-24015 does not support framework .NETFramework,Version=v4.6.1.

Running on dotnetcore runs ok.

davidfowl commented 8 years ago

Move the dependency on Microsoft.NETCore.App to the netcoreapp target framework only.

evertmulder commented 8 years ago

Thanks David. This works. I think the correct config for rc2 is:

  "dependencies": {
    "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0-*",
    "Microsoft.AspNetCore.Authentication.Facebook": "1.0.0-*",
    "Microsoft.AspNetCore.Authentication.Google": "1.0.0-*",
    "Microsoft.AspNetCore.Authentication.MicrosoftAccount": "1.0.0-*",
    "Microsoft.AspNetCore.Authentication.OpenIdConnect": "0.1.0-*",
    "Microsoft.AspNetCore.Authentication.Twitter": "1.0.0-*",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-*",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-*",
    "Microsoft.AspNetCore.Mvc": "1.0.0-*",
    "Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0-*",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-*",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
    "Microsoft.AspNetCore.Server.WebListener": "0.1.0-*",
    "Microsoft.AspNetCore.Session": "1.0.0-*",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-*",
    "Microsoft.EntityFrameworkCore.InMemory": "1.0.0-*",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-*",
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0-*",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-*",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-*",
    "Microsoft.Extensions.Logging.Console": "1.0.0-*",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0-*"
  },
  "frameworks": {
    "net451": {},
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.0.0-*"
        }
      },
      "imports": [
        "portable-net45+wp80+win8+wpa81+dnxcore50",
        "portable-net45+win8+wp8+wpa81",
        "portable-net45+win8+wp8"
      ]
    }
  }
}
sds123 commented 8 years ago

Thanks all @BeelzeBu , @kichalla .......I have 1 question. Could anyone successfully run E2ETest

I get the below error

Project E2ETests (.NETStandardApp,Version=v1.5) was previously compiled. Skipping compilation.
xUnit.net Runner (64-bit win81-x64)
  Discovering: E2ETests
  Discovered:  E2ETests
  Starting:    E2ETests

    E2ETests.SmokeTests_X64.WindowsOS(serverType: Kestrel, runtimeFlavor: CoreClr, architecture: x64, applicationBaseUrl: "http://localhost:5000/") [FAIL]
      System.ComponentModel.Win32Exception : The system cannot find the file specified
      Stack Trace:
           at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
           at Microsoft.AspNetCore.Server.Testing.ApplicationDeployer.DotnetPublish(String publishRoot)
           at Microsoft.AspNetCore.Server.Testing.SelfHostDeployer.Deploy()
        c:\Musicstore\MusicStore-dev\test\E2ETests\SmokeTests.cs(92,0): at E2ETests.SmokeTests.<SmokeTestSuite>d__2.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
        c:\Musicstore\MusicStore-dev\test\E2ETests\SmokeTests.cs(39,0): at E2ETests.SmokeTests_X64.<WindowsOS>d__2.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      Output:
        | Information: Deploying [Variation] :: ServerType=Kestrel, Runtime=CoreClr, Arch=x64, BaseUrlHint=http://localhost:5000/, Publish=True
        | Information: Executing command dotnet publish "c:\Musicstore\MusicStore-dev\src\MusicStore" -o "C:\Users\.....\AppData\Local\Temp\a36dd7a7-1b74-4c58-a14d-9babb7b3f34d" --framework netstandardapp1.5
        | Warning: Host process already exited or never started successfully.
        | Warning: Failed to delete directory : Could not find a part of the path 'C:\Users\.....\AppData\Local\Temp\a36dd7a7-1b74-4c58-a14d-9babb7b3f34d'.
        | Information: Trying to drop database 'MusicStore_Test_7ffe29bebae0498c8876b29223d344c3'
        | Information: Successfully dropped database MusicStore_Test_7ffe29bebae0498c8876b29223d344c3
        | Information: [Time]: Total time taken for this test variation '0.175127' seconds
  Finished:    E2ETests
Eilon commented 8 years ago

Closing this because we haven't seen these issues in quite some time. These issues are often caused by temporary mismatches in versions. If you're seeing any new issues please log a new issue. Thanks!