Skip to content
This repository was archived by the owner on Mar 23, 2022. It is now read-only.

Add aspnetcore support #127

Merged
merged 19 commits into from
Oct 3, 2016
Merged

Conversation

andrewlock
Copy link
Contributor

Fixes #62

I think this provides the most amount of reuse possible - currently the vast majority of files are shared between the Core and Core.AspNetCore projects, with files added as links. The IApplicationBuilderExtensions and IAppBuilderExtensions are isolated to their respective projects.

Similarly for the test project, common files are shared between projects, with the OWIN and ASP.NET Core interfaces in their respective projects.

Duplicate UsageSamples for the standard and MVC projects have been created for the ASP.NET Core versions.

The build and NuGet package builds have not yet been updated

@khalidabuhakmeh
Copy link
Contributor

Make sure you sign up for Hacktoberfest, so you get a free TShirt.

@khalidabuhakmeh
Copy link
Contributor

Pulled and reviewed and LGTM. The only head scratcher is how to build these two parallel projects. This looks like more research.

I assume the following would not work for the csproj projects.

> dotnet restore
> dotnet build **/project.json

@billbogaiv
Copy link
Member

@khalidabuhakmeh @andrewlock: if you really want the t-shirt, maybe close this PR and open a new one in a couple days...

Rules
To get a shirt, you must make four pull requests between October 1 and October 31.

Ref. https://hacktoberfest.digitalocean.com/

@khalidabuhakmeh
Copy link
Contributor

Four!!!!

@andrewlock
Copy link
Contributor Author

Haha, yeah I may have to!;)

WRT building, we can't build csproj with dotnet, no, but I think we can do the reverse, with a dotnet hook into msbuild..

I've pushed up a commit which hopefully will fix the build (hard to know as can't see the details though!)

@khalidabuhakmeh
Copy link
Contributor

We are working on making our team city publicly accessible it is annoying when working remote because we have to VPN in. That said, our CI just runs build.cmd which you can run locally.

@andrewlock
Copy link
Contributor Author

Good to know, running build.cmd locally seems to work and produces the NuGet file - can you confirm it works locally on your machine? I assume the CI server has the .NET Core SDK installed?

@khalidabuhakmeh
Copy link
Contributor

What version of Nuget are you using? I assume 3, and our build server is using 2.something. Just wanting to confirm. Thanks.

@khalidabuhakmeh
Copy link
Contributor

Build output is below. It seems like we may just need to update the cli on our build agents.

[07:47:44][Updating sources] Will perform clean checkout. Reason: "Clean all files before build" turned on
[07:47:44][Updating sources] Transferring cached clean patch for VCS root: Github
[07:47:44][Updating sources] Repository sources transferred: 2.54 MB total
[07:47:44][Updating sources] Removing F:\BuildAgent\work\6072dd679b9bde82
[07:47:44][Updating sources] Updating F:\BuildAgent\work\6072dd679b9bde82
[07:47:44]Resolving artifact dependencies
[07:47:44]Step 1/1: Build Script (Command Line) (1s)
[07:47:44][Step 1/1] Starting: F:\BuildAgent\work\6072dd679b9bde82\build.cmd /l:JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger,F:\BuildAgent\plugins\dotnetplugin\bin\JetBrains.BuildServer.MSBuildLoggers.4.0.dll;Verbosity=Normal;PerformanceSummary /noconlog
[07:47:44][Step 1/1] in directory: F:\BuildAgent\work\6072dd679b9bde82
[07:47:45][Step 1/1] build\Build.msbuild: Build default targets (1s)
[07:47:45][build\Build.msbuild] Restoring solution dependencies...
[07:47:45][build\Build.msbuild] F:\BuildAgent\work\6072dd679b9bde82\.nuget\nuget.exe restore -NonInteractive -ConfigFile "F:\BuildAgent\work\6072dd679b9bde82\nuget.config"
[07:47:46][build\Build.msbuild] TODO: unknown keyword platform
[07:47:46][build\Build.msbuild] F:\BuildAgent\work\6072dd679b9bde82\build\Build.msbuild(30, 5): error MSB3073: The command "F:\BuildAgent\work\6072dd679b9bde82\.nuget\nuget.exe restore -NonInteractive -ConfigFile "F:\BuildAgent\work\6072dd679b9bde82\nuget.config"" exited with code 1.
[07:47:46][Step 1/1] 
[07:47:46][Step 1/1] *** BUILD FAILED ***
[07:47:46][Step 1/1] 
[07:47:46][Step 1/1] Process exited with code 1
[07:47:46][Step 1/1] Step Build Script (Command Line) failed
[07:47:46]Publishing internal artifacts
[07:47:46][Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[07:47:46][Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
[07:47:46]Publishing artifacts
[07:47:46][Publishing artifacts] Collecting files to publish: [artifacts/*.nupkg, artifacts/build/*.nupkg, msbuild.log]
[07:47:46][Publishing artifacts] Artifacts path 'artifacts/*.nupkg' not found
[07:47:46][Publishing artifacts] Artifacts path 'artifacts/build/*.nupkg' not found
[07:47:46][Publishing artifacts] Publishing 1 file [artifacts/*.nupkg] using [WebPublisher]
[07:47:46][Publishing artifacts] Publishing 1 file [artifacts/*.nupkg] using [ArtifactsCachePublisher]
[07:47:52]Build finished

@andrewlock
Copy link
Contributor Author

I'll check when I'm back later, but pretty sure it's NuGet 3. I'm not 100%, but I think you have to be on 3 for it to work with project.json?

@jrusbatch
Copy link
Contributor

@andrewlock Can you try adding this global.json to the root of the repository?

{
    "projects": [ "src", "test" ],
    "sdk": {
        "version": "1.0.0-preview2-003121"
    }
}

@khalidabuhakmeh
Copy link
Contributor

The latest version is 1.0.0-preview2-003133 that takes into account the 1.0.1 patch release.

@andrewlock
Copy link
Contributor Author

Oops, hadn't noticed I'd missed that (normally created automatically with sln, but I just added to the existing one)

@khalidabuhakmeh
Copy link
Contributor

Open in IDE
GETSDKTOOLINGINFO The project is configured to use .NET Core SDK version 1.0.0-preview2-003133 which is not installed or cannot be found under the path C:\Program Files\dotnet. These components are required to build and run this project. Download the version of .NET Core SDK specified in global.json or update the SDK version in global.json to the version that is installed.
Step Build Script (Command Line) failed

@khalidabuhakmeh
Copy link
Contributor

@andrewlock be sure you do a git clean -xdf and then run build.cmd. @jrusbatch and I are seeing issues with references in the sample projects.

 Restoring solution dependencies...
  C:\Program Files\dotnet\dotnet.exe build "C:\projects\stuntman\tests\Core.AspNetCore.Tests" --configuration Release --no-dependencies
  Project Core.AspNetCore.Tests (.NETFramework,Version=v4.5.1) will be compiled because expected inputs are missing
  Compiling Core.AspNetCore.Tests for .NETFramework,Version=v4.5.1
  C:\Program Files\dotnet\dotnet.exe build "C:\projects\stuntman\samples\UsageSample.AspNetCore" --configuration Release --no-dependencies
  Project UsageSample.AspNetCore (.NETCoreApp,Version=v1.0) will be compiled because expected inputs are missing
  Compiling UsageSample.AspNetCore for .NETCoreApp,Version=v1.0
  Core -> C:\projects\stuntman\src\Core\bin\Release\RimDev.Stuntman.Core.dll
  C:\Program Files\dotnet\dotnet.exe compile-csc @C:\projects\stuntman\samples\UsageSample.AspNetCore\obj\Release\netcoreapp1.0\dotnet-compile.rsp returned Exit Code 1
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): error : C:\projects\stuntman\samples\UsageSample.AspNetCore\error CS0006: M etadata file 'C:\projects\stuntman\src\Core.AspNetCore\bin\Release\netstandard1.4\RimDev.Stuntman.Core.AspNetCore.dll' could not be found [C:\projects\stuntman\samples\UsageSample.As pNetCore\UsageSample.AspNetCore.xproj]
  Compilation failed.
      0 Warning(s)
      1 Error(s)
  Time elapsed 00:00:01.6343462
  Core.Tests -> C:\projects\stuntman\tests\Core.Tests\bin\Release\RimDev.Stuntman.Core.Tests.dll
  UsageSample -> C:\projects\stuntman\samples\UsageSample\bin\RimDev.Stuntman.UsageSample.dll
  UsageSampleMvc -> C:\projects\stuntman\samples\UsageSampleMvc\bin\RimDev.Stuntman.UsageSampleMvc.dll
  C:\Program Files\dotnet\dotnet.exe compile-csc @C:\projects\stuntman\tests\Core.AspNetCore.Tests\obj\Release\net451\dotnet-compile.rsp returned Exit Code 1
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): error : C:\projects\stuntman\tests\Core.AspNetCore.Tests\error CS0006: Meta data file 'C:\projects\stuntman\src\Core.AspNetCore\bin\Release\net451\RimDev.Stuntman.Core.AspNetCore.dll' could not be found [C:\projects\stuntman\tests\Core.AspNetCore.Tests\Core. AspNetCore.Tests.xproj]
  Compilation failed.
      0 Warning(s)
      1 Error(s)
  Time elapsed 00:00:02.8461464
  UsageSample.BearerTokenTester -> C:\projects\stuntman\samples\UsageSample.BearerTokenTester\bin\Release\UsageSample.BearerTokenTester.exe
  UsageSample.ServerTester -> C:\projects\stuntman\samples\UsageSample.ServerTester\bin\Release\UsageSample.ServerTester.exe
  C:\Program Files\dotnet\dotnet.exe build "C:\projects\stuntman\src\Core.AspNetCore" --configuration Release --no-dependencies
  Project Core.AspNetCore (.NETFramework,Version=v4.5.1) will be compiled because expected outputs are missing
  Compiling Core.AspNetCore for .NETFramework,Version=v4.5.1
  Compilation succeeded.
      0 Warning(s)
      0 Error(s)
  Time elapsed 00:00:01.9774430

  Project Core.AspNetCore (.NETStandard,Version=v1.4) will be compiled because expected outputs are missing
  Compiling Core.AspNetCore for .NETStandard,Version=v1.4
  Compilation succeeded.
      0 Warning(s)
      0 Error(s)
  Time elapsed 00:00:01.8137436

  C:\Program Files\dotnet\dotnet.exe build "C:\projects\stuntman\samples\UsageSampleMvc.AspNetCore" --configuration Release --no-dependencies
  Project UsageSampleMvc.AspNetCore (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
  Compiling UsageSampleMvc.AspNetCore for .NETCoreApp,Version=v1.0
  Compilation succeeded.
      0 Warning(s)
      0 Error(s)
  Time elapsed 00:00:02.4032479


*** BUILD FAILED ***

@andrewlock
Copy link
Contributor Author

Argh nuts, will do. I had repeated issues trying to get the naming correct. The problem is that project.json currently leans heavily on the name of the project being the same as the folder. I thought I'd found a setup that works, but clearly not.

In keeping with the other Core project I tried updating the Assembly and package name in project.json to the full RimDev.Stuntman etc package name, while keeping the folder as Core.AspNetCore. The problem is that the VS tooling doesn't seem to like various combinations of this when these do not all match.

A very simple fix would be to rename the Core.AspNetCore folder to RimDev.Stuntman.Core.AspNetCore, but that obviously goes against the current convention. Otherwise I think either the package name created by dotnet pack or the assembly dll name (I can't remember which) may need to be Core.AspNetCore for the references to work out, both on the command line and in VS.

I'll take a look a little later, but how do you feel about renaming the folder if I can't find another approach?

@khalidabuhakmeh
Copy link
Contributor

running build.cmd twice works...

I think this is an ordering thing that MSBuild isn't handling correctly.

@khalidabuhakmeh
Copy link
Contributor

Note: It works in Visual Studio the first time you build.

@andrewlock
Copy link
Contributor Author

Doh, really thought I'd got it that time - it works first time after a git clean -xdf now...

@jrusbatch
Copy link
Contributor

@andrewlock The build is passing now. We just needed to update the .NET Core SDK on our TeamCity build agents.

billbogaiv and others added 2 commits October 3, 2016 14:53
Because tooling is not quite where we want it with respect to project name vs. NuGet package name AND referencing projects via project.json, we decided to rename the .NET Core project directory.

Note: original attempt to update project.json with:

{
  "name": "RimDev.Stuntman.Core.AspNetCore"
}

fails since the project can no longer be referenced by other projects (i.e. test projects). The project by itself compiles just fine, however >:(
Update assembly/package naming behavior
@jrusbatch jrusbatch removed their assignment Oct 3, 2016
@billbogaiv billbogaiv merged commit d6abf73 into ritterim:master Oct 3, 2016
@andrewlock andrewlock deleted the add-aspnetcore-support branch October 3, 2016 20:54
@kendaleiv
Copy link
Contributor

The new package was published to https://www.nuget.org/packages/RimDev.Stuntman.Core.AspNetCore. Did we want to have this new package be RimDev.Stuntman.AspNetCore instead?

@billbogaiv
Copy link
Member

Yes. I am going to rename and submit a PR shortly.

@billbogaiv
Copy link
Member

Ref. #131

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants