Skip to content

Support .NET Standard 2.0 and move to VS 2017#2263

Merged
304NotModified merged 14 commits intoNLog:masterfrom
snakefoot:Vs2017NetCore2
Sep 16, 2017
Merged

Support .NET Standard 2.0 and move to VS 2017#2263
304NotModified merged 14 commits intoNLog:masterfrom
snakefoot:Vs2017NetCore2

Conversation

@snakefoot
Copy link
Copy Markdown
Contributor

@snakefoot snakefoot commented Aug 24, 2017

Initial attempt for converting to new VS2017 csproj file format.

  • NetStandard 2.0
  • Net45, Net40-client, Net35 (Moved net40 to net40-client nuget-lib-folder)
  • Silverlight 4, Silverlight 5, Windows Phone
  • XamarinIOS 1.0
  • MonoAndroid (Upgraded from 2.3 to 4.4)
  • OpenCover
  • Travis NetStandard 2.0
  • Travis Mono 5.2 Net45 (Ver. 5.2 needed for msbuild support)
  • Cherry picking from coreclr-branch (NLog 5.0 BETA)
  • Strong Name Version remains static (ver. 4.0.0.0)
  • xUnit 2.3.0-beta5 (BETA Needed for NetStandard 2.0)
  • xUnit 2.0 testing of net35 and net40-client
  • NLog-Docs-csproj (Maybe handled by GenerateDocumentationFile=true) -> not used
  • NLog-BuildDocPages -> not used for now
  • NLog-CheckSourceCode
  • NLog.Extended package
  • NLog.Schema package (XSD Generation for config-file-intellisense) -> Julian
  • NLog.Config package
  • NLog.Snippets package (Maybe it is replaced by https://github.com/NLog/NLogSnippetsVSIX)
  • NLog.shfbproj (Sandcastle help file) -> revert

Replaces #2175 and #2154 and resolves #2152, resolves #1954 and resolves #1953

@snakefoot snakefoot force-pushed the Vs2017NetCore2 branch 2 times, most recently from f179bb5 to 4958fab Compare August 24, 2017 20:39
@luigiberrettini
Copy link
Copy Markdown
Contributor

luigiberrettini commented Aug 24, 2017

Number one in using latest tools and contributing to projects with your expertise 👍

Just to avoid confusion I would rename this PR as "VS 2017 and .NET Standard 2.0"

@snakefoot snakefoot force-pushed the Vs2017NetCore2 branch 9 times, most recently from b371a2a to e8d1e40 Compare August 26, 2017 20:22
@snakefoot
Copy link
Copy Markdown
Contributor Author

@luigiberrettini You can now play around with this nuget-package:

https://ci.appveyor.com/project/nlog/nlog/build/4.5.0-beta5831/artifacts

@snakefoot snakefoot force-pushed the Vs2017NetCore2 branch 5 times, most recently from a32a49a to 457945d Compare August 26, 2017 21:17
@snakefoot
Copy link
Copy Markdown
Contributor Author

snakefoot commented Aug 26, 2017

@304NotModified It would be nice if this PR is merged before any other PR (When it looks stable), as the conflict rate is quite high with this one. So please delay any merging of any other PR.

@snakefoot snakefoot force-pushed the Vs2017NetCore2 branch 2 times, most recently from ae98ae6 to 05b4296 Compare August 26, 2017 21:32
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 26, 2017

Codecov Report

Merging #2263 into master will increase coverage by <1%.
The diff coverage is 60%.

@@           Coverage Diff           @@
##           master   #2263    +/-   ##
=======================================
+ Coverage      82%     82%   +<1%     
=======================================
  Files         304     304            
  Lines       21312   21374    +62     
  Branches     2570    2576     +6     
=======================================
+ Hits        17407   17463    +56     
- Misses       3250    3256     +6     
  Partials      655     655

@snakefoot
Copy link
Copy Markdown
Contributor Author

snakefoot commented Aug 26, 2017

@304NotModified Seems that the AppVeyor-build-image for VS2017 includes NetCore2, but VS2017 has dropped support for Silverlight. And the AppVeyor-build-image for VS2015 does not include NetCore 2.0 SDK.

Any ideas how to solve this? Moving forward without Silverlight ? Am I missing a magic parameter?

Seems I found the solution. Just needed to specify some extra magic parameters for the Silverlight and Windows Phone build. New Nuget-package ready:

https://ci.appveyor.com/project/nlog/nlog/build/4.5.0-beta5853/artifacts

@snakefoot snakefoot force-pushed the Vs2017NetCore2 branch 7 times, most recently from 1d2579e to 54eaa52 Compare August 27, 2017 19:09
@luigiberrettini
Copy link
Copy Markdown
Contributor

As for SandCastle I think you cannot put everything in this PR: you should guarantee the current behavior not the hoped future one 😉

It should be enough to keep Sandcastle Help File Builder files in NLog\src\Docs\Frameworks and enable building docs as it is done now, as @304NotModified explains in #655, with something like:

msbuild NLog.proj /t:rebuild /t:BuildIndividualDocumentation /p:BuildLastMajorVersion=4.0.0 /p:AssemblyFileVersion=4.1.2 /p:BuildVersion=4.1.2 /p:configuration=release /p:BuildLabelOverride=NONE

which relies on the target:

<Target Name="BuildIndividualDocumentation">
    <Exec Command='"$(WinDir)\Microsoft.NET\Framework\v3.5\MSBuild.exe" Docs\NLog.shfbproj /p:Framework="%(TargetFramework.Identity)" /p:Configuration=$(Configuration) /p:BuildLabel="$(BuildLabel)" /p:BuildVersion="$(BuildVersion)"' ContinueOnError="$(BuildAllFrameworks)" />
</Target>

A developer working on #655 will then start from master improving docs on the base of the work merged from this PR

@snakefoot
Copy link
Copy Markdown
Contributor Author

snakefoot commented Sep 10, 2017 via email

@snakefoot
Copy link
Copy Markdown
Contributor Author

snakefoot commented Sep 10, 2017

Made a very crude comparison of build-timings:

Task master This PR
Building nupkg's 110 sec 100 sec
UnitTest - NetStandard Release 100 sec (2060 tests)
UnitTest - Net35 Release 130 sec (2154 tests) 179 sec (2205 tests)
UnitTest - Net40 Release 130 sec (2192 tests) 177 sec (2215 tests)
OpenCover - Net45 Debug 311 sec (2223 tests) 415 sec (2223 tests)

Maybe xunit ver. 1.9.1 is faster than xunit ver. 2.3 BETA ? OpenCover is using the same configuration and same test-runner, and the only difference is that the NLogUnitTest-dll depends on xUnit ver. 2.3 (instead of xUnit ver. 1.9)

xunit/xunit#353

Can see that "UnitTest - Net45 Release" in older builds took 284 sec (2221 tests), so dotnet test doesn't seem faster (But it is also just a wrapper around xUnit 2.3)

@304NotModified
Copy link
Copy Markdown
Member

any idea why this error is red?

image

Made a very crude comparison of build-timings:

Thanks, I think the xunit warnings aren't helping

@snakefoot
Copy link
Copy Markdown
Contributor Author

snakefoot commented Sep 11, 2017

@304NotModified any idea why this error is red?

Nope. But it seems the console-output from the unit-tests is now flowing into the normal test-runner-output (change from xUnit ver. 1.9.1 to 2.3). And when using Console.Error, then it becomes red.

@304NotModified
Copy link
Copy Markdown
Member

OK, double checked the packages. Looks good!

Last question, any idea why appveyor shows only 4291 unit tests? It should be +8000 ?

image

@snakefoot
Copy link
Copy Markdown
Contributor Author

Last question, any idea why appveyor shows only 4291 unit tests? It should be +8000 ?

No idea how xUnit and AppVeyor is working together. Will try and change my net35 + net40 hack, so it doesn't reuse the same net452-FilePath for the 3 tests (net452, net40-client + net35)

@snakefoot
Copy link
Copy Markdown
Contributor Author

snakefoot commented Sep 11, 2017

Seems the AppVeyor-logic for xUnit has two identifiers for the unit-test-assembly-name (HandleTestAssemblyStarting):

  • FileName of the unit-test-dll (Cannot change this because of InternalsVisibleTo)
  • TargetFrameworkAttribute of the unit-test-dll (Will require artificial build of net461 and net462, so it differs from net452)

Little annoying it is not possible to reuse the same unit-test-dll with different configuration options (and add a prefix/suffix to the unit-test-assembly-name.

@304NotModified
Copy link
Copy Markdown
Member

304NotModified commented Sep 11, 2017

FileName of the unit-test-dll (Cannot change this because of InternalsVisibleTo)

Can't we add multiple InternalsVisibleTo attributes?

@snakefoot
Copy link
Copy Markdown
Contributor Author

Well we can add multiple InternalsVisibleTo attributes?

Sure make a PR, that works, then I will merge it into this. Or you can just do it after having merged this to master :)

@luigiberrettini
Copy link
Copy Markdown
Contributor

The PowerShell error is caused by the launch of an external command and the handling of streams:
http://mnaoumov.wordpress.com/2015/01/11/execution-of-external-commands-in-powershell-done-right/

@snakefoot
Copy link
Copy Markdown
Contributor Author

snakefoot commented Sep 11, 2017

The PowerShell error is caused by the launch of an external command and the handling of stream

Trying a newer version of xunit.console.runner, instead of the one provided by AppVeyor. Maybe it is better at shielding the PowerShell from the rogue NLog-Unit-Tests. ** Update ** Nope didn't help

@snakefoot
Copy link
Copy Markdown
Contributor Author

snakefoot commented Sep 11, 2017

Have now fixed the rogue NLog UnitTests that spat into Console.Error and Console.Out. Now the PowerShell can sleep at night.

@luigiberrettini
Copy link
Copy Markdown
Contributor

As for snippets:

  • VSIntegration contains files from 6 years ago
  • uninstall is manual
  • they should definitely be moved to another repo those build creates a NuGet package that people interested in snippets can download and use (maybe snipppets fro mi the NLog repo can be merged with what has been done I need the NLogSnippetsVSIX repo)

Since snippets are six years old I suppose they are not updated on each release and this PR could ignore including their NuGet package creation, but this should be confirmed by @304NotModified 😉

@304NotModified
Copy link
Copy Markdown
Member

Since snippets are six years old I suppose they are not updated on each release and this PR could ignore including their NuGet package creation, but this should be confirmed by @304NotModified 😉

yes we could ignore the Vsintergration now. Will check this in the list

@304NotModified
Copy link
Copy Markdown
Member

reminder for myself

  • tests results summary on Appveyor: "Total tests:" (1x) and "=== TEST EXECUTION SUMMARY ==" (3x)
  • tests results summary on Travis: "Total tests:" (1x) and "=== TEST EXECUTION SUMMARY ==" (1x)

@304NotModified
Copy link
Copy Markdown
Member

304NotModified commented Sep 16, 2017

merged! Great job @snakefoot ! thanks! thanks @luigiberrettini ! 🎉

@snakefoot
Copy link
Copy Markdown
Contributor Author

@304NotModified Glad it is done. Not a funny PR to get through. Lots of old skeletons suddenly came jumping out of the closet. And the VS2017 tooling was not super obvious when all sources were saying "always use the new dotnet command".

I guess we should checkout if nUnit or MsTest2 (or something else) would perform better than xUnit, so the build-time could be reduced.

@304NotModified
Copy link
Copy Markdown
Member

I think we could win some time by disabling the xunit warnings (could be disabled I assume). Also the build log is then more readable ;)

@i02coroj
Copy link
Copy Markdown

Hi all.
Sorry if this is a stupid question.
I'm working right now in a .Net Standard 2.0 project. So I would need use this last NLog version supporting it.
But looking in Nuget gallery I see the package NLog.Web.AspNetCore is not updated since more than 3 months ago, so it obviously doesn't contain all this new stuff.

Do you have in mind upload it? How could I use it in the meantime? Am I forced to include the libraries inside my project? Thank yoj.

@snakefoot
Copy link
Copy Markdown
Contributor Author

snakefoot commented Sep 26, 2017

@304NotModified I think we could win some time by disabling the xunit warnings (could be disabled I assume).

I think the reason for the slower builds is the change to VS2017 AppVeyor-Build-Image. These are the build-timings on Travis, before and after the change to VS2017:

Before: https://travis-ci.org/NLog/NLog/builds/262388322 - 82.205 (NLog.UnitTests Total: 2042)
After: https://travis-ci.org/NLog/NLog/builds/280157224 - 85.508s (NLog.UnitTests Total: 2135)

Maybe the AppVeyor-build-servers that supports VS2017-images are configured differently?

@304NotModified
Copy link
Copy Markdown
Member

at least 2017 preview is slower: source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants