[{"data":1,"prerenderedAt":497},["ShallowReactive",2],{"article-net-standard-vs-net-core":3},{"article":4,"tags":205,"previous":220,"next":436},{"id":5,"title":6,"author":7,"body":8,"createdAt":193,"description":194,"extension":195,"img":196,"meta":197,"navigation":198,"path":199,"seo":200,"stem":201,"tags":202,"updatedAt":193,"__hash__":204},"articles\u002Farticles\u002Fnet-standard-vs-net-core.md",".NET Standard vs. .NET Core",null,{"type":9,"value":10,"toc":189},"minimark",[11,15,18,21,24,44,111,169],[12,13,14],"p",{},"In Visual Studio, there are at least 3 different types of class library you can create:",[12,16,17],{},"*Class Library (.NET Framework)\n*Class Library (.NET Standard)\n*Class Library (.NET Core)",[12,19,20],{},"Use a .NET Standard library when you want to increase the number of apps that will be compatible with your library, and you are okay with\na decrease in the .NET API surface area your library can access.",[12,22,23],{},"Use a .NET Core library when you want to increase the .NET API surface area your library can access, and you are okay with allowing only\n.NET Core apps to be compatible with your library.",[12,25,26,27,31,32,35,36,39,40,43],{},"Difference:\nCompatibility: Libraries that target .NET Standard will run on any .NET Standard compliant runtime, such as .NET Core, .NET Framework, Mono\u002FXamarin. On the other hand, libraries that target .NET Core can only run on the .NET Core runtime.\nAPI Surface Area: .NET Standard libraries come with everything in ",[28,29,30],"code",{},"NETStandard.Library"," whereas .NET Core libraries come with everything in ",[28,33,34],{},"Microsoft.NETCore.App",". The latter includes approximately 20 additional libraries, some of which we can add manually to our .NET Standard library (such as ",[28,37,38],{},"System.Threading.Thread",") and some of which are not compatible with the .NET Standard (such as ",[28,41,42],{},"Microsoft.NETCore.CoreCLR",").\nAlso, .NET Core libraries specify a runtime and come with an application model. That's important, for instance, to make unit test class libraries runnable.\nIgnoring libraries for a moment, the reason that .NET Standard exists is for portability; it defines a set of APIs that .NET platforms agree to implement. Any platform that implements a .NET Standard is compatible with libraries that target that .NET Standard. One of those compatible platforms is .NET Core.\nComing back to libraries, the .NET Standard library templates exist to run on multiple runtimes (at the expense of API surface area). Obversely, the .NET Core library templates exist to access more API surface area (at the expense of compatibility) and to specify a platform against which to build an executable.\nSaid another way…",[12,45,46,47,51,52,55,56,59,60,63,64,67,68,71,74,75,63,77,79,80,83,84,63,86,88,89,92,93,95,96,99,100,103,104,106,107,110],{},"A ",[48,49,50],"strong",{},".Net Core Class Library"," is built upon the ",[48,53,54],{},".Net Standard",". If you want to implement a library that is portable to the ",[48,57,58],{},".Net Framework",", .",[48,61,62],{},"Net Core"," and ",[48,65,66],{},"Xamarin",", choose a ",[48,69,70],{},".Net Standard Library",[48,72,73],{},".Net Core will ultimately implement .Net Standard 2"," (as will ",[48,76,66],{},[48,78,58],{},")\n",[48,81,82],{},".Net Core",", ",[48,85,66],{},[48,87,58],{}," can, therefore, be identified as ",[48,90,91],{},"flavours"," of ",[48,94,54],{},"\nTo future-proof your applications for code sharing and reuse , you would rather implement .Net Standard libraries.\nMicrosoft also recommends that you use ",[48,97,98],{},".NET Standard"," instead of ",[48,101,102],{},"Portable Class Libraries",".\nTo quote MSDN as an authoritative source, ",[48,105,54],{}," is intended to be ",[48,108,109],{},"One Library to Rule Them All",".",[12,112,113,115,116,118,119,122,123,126,127,130,131,63,134,137,138,141,142,59,145,148,149,151,152,155,156,158,159,161,162,164,165,168],{},[48,114,98],{}," solves the code sharing problem for .NET developers across all platforms by bringing all the APIs that you expect and love across the environments that you need: desktop applications, mobile apps & games, and cloud services:\n",[48,117,98],{}," is a ",[48,120,121],{},"set of APIs"," that ",[48,124,125],{},"all"," .NET platforms ",[48,128,129],{},"have to implement",". This ",[48,132,133],{},"unifies the .NET platforms",[48,135,136],{},"prevents future fragmentation",".\n",[48,139,140],{},".NET Standard 2.0"," will be implemented by ",[48,143,144],{},".NET Framework",[48,146,147],{},"NET Core",", and ",[48,150,66],{},". For ",[48,153,154],{},".NET Core",", this will add many of the existing APIs that have been requested.\n",[48,157,140],{}," includes a compatibility shim for ",[48,160,144],{}," binaries, significantly increasing the set of libraries that you can reference from your .NET Standard libraries.\n",[48,163,98],{}," ",[48,166,167],{},"will replace Portable Class Libraries (PCLs)"," as the tooling story for building multi-platform .NET libraries.",[12,170,171,172,176,164,180,183,186],{},"References: ",[173,174],"a",{"title":175,"href":175},"https:\u002F\u002Fblogs.msdn.microsoft.com\u002Fdotnet\u002F2016\u002F09\u002F26\u002Fintroducing-net-standard\u002F",[173,177,175],{"href":175,"rel":178},[179],"nofollow",[181,182],"br",{},[173,184],{"title":185,"href":185},"https:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F42939454\u002Fwhat-is-the-difference-between-net-core-and-net-standard-class-library-project",[173,187,185],{"href":185,"rel":188},[179],{"title":190,"searchDepth":191,"depth":191,"links":192},"",2,[],"2018-10-30T16:21:49.892Z","Core vs. Standard has come up a lot recently.  I wanted to re-emphasize the differences here for my own purposes using references mentioned below.  Really important to know and understand.","md","\u002Farticles\u002Fimages\u002Fopen-live-writer-keep-nuget-packages-out-of-tfs-source-co_8714-tfs3_thumb.png",{},true,"\u002Farticles\u002Fnet-standard-vs-net-core",{"title":6,"description":194},"articles\u002Fnet-standard-vs-net-core",[203],"netcore","kx8ta9AYIZhNb3zhlW22x73UcUBy7FRGgPUlFaQWAC0",[206],{"id":207,"title":208,"body":209,"description":213,"extension":195,"img":214,"meta":215,"name":203,"navigation":198,"path":216,"seo":217,"stem":218,"__hash__":219},"tags\u002Ftags\u002Fnetcore.md","Netcore",{"type":9,"value":210,"toc":211},[],{"title":190,"searchDepth":191,"depth":191,"links":212},[],".NET Core is a new version of .NET Framework, which is a free, open-source, general-purpose development platform maintained by Microsoft. It is a cross-platform framework that runs on Windows, macOS, and Linux operating systems.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fnetcore",{"description":213},"tags\u002Fnetcore","D5BWCPpKVXJTUKU0TRuD3sWQ9rXtqETGkxzHAK__g5w",{"id":221,"title":222,"author":7,"body":223,"createdAt":427,"description":428,"extension":195,"img":304,"meta":429,"navigation":198,"path":430,"seo":431,"stem":432,"tags":433,"updatedAt":427,"__hash__":435},"articles\u002Farticles\u002Fxunit-what-is-it-and-why-another-unit-testing-framework.md","xUnit–what is it and why another unit testing framework",{"type":9,"value":224,"toc":425},[225,231,264,267,271,387,390,404,407],[12,226,227,228,230],{},"Special thank you for Channel 9 and @skimedic for sharing his unit testing knowledge.",[181,229],{},"\nXUnit leverage some of the new features to help developers write cleaner test, as tests should be kept clean and treated as first-class citizens.",[232,233,234,238,241,252,255],"ul",{},[235,236,237],"li",{},"NUnit was not fully compatible with .NET Core 2 at the time",[235,239,240],{},"xUnit is aimed at improving test isolation and trying to codify a set of rules to establish a testing standard.",[235,242,243,244,63,248,251],{},"xUnit ",[245,246,247],"span",{},"Fact",[245,249,250],{},"Theory"," attributes are extensible, so you can implement your own testing functionality.xUnit doesn’t use Test Lists and .vsmdi files to keep track of your tests.",[235,253,254],{},"Microsoft is using xUnit internally, one of its creators is from Microsoft. xUnit was also created by one of the original authors of NUnit.",[235,256,257,258,261],{},"Side-by-side Performance Comparison of testing frameworks can be found here ",[173,259],{"title":260,"href":260},"https:\u002F\u002Fblogs.msdn.microsoft.com\u002Fvisualstudio\u002F2017\u002F11\u002F16\u002Ftest-experience-improvements\u002F",[173,262,260],{"href":260,"rel":263},[179],[12,265,266],{},"Where to get it and how to add it to your projects (2 ways)",[268,269,270],"ol",{},"  \n* Use Nuget to add xunit as well as the runner  \n* Add New Project – .NET Core xUnit Test Project  \n",[232,272,273,276,282,285,290,293,308,311,314,326,329,332,335,342,345,357,360,370,373,376],{},[235,274,275],{},"It does work with live unit testing",[235,277,278,279,281],{},"Add ",[245,280,247],{}," attribute on a method to mark it as a test",[235,283,284],{},"Use Theory and InlineData as mechanism to pass data into the test",[235,286,287,289],{},[245,288,250],{}," attribute to mark a method as a test and setup incoming parameters (2 approaches InlineData and MemberData)",[235,291,292],{},"[InlineData(1,2,3)",[235,294,295,296],{},"approach to pass data into the test method (add additional InlineData attributes for multiple runs of same test)\n",[173,297,299],{"href":298},"\u002Farticles\u002Fimages\u002FSNAGHTML2e5cfd1e_636767597902517481.png",[300,301],"img",{"style":302,"title":303,"src":304,"alt":303,"width":305,"height":306,"border":307},"border: 0px currentcolor; display: inline; background-image: none;","SNAGHTML2e5cfd1e","\u002Farticles\u002Fimages\u002FSNAGHTML2e5cfd1e_thumb_636767597903473559.png",487,209,0,[235,309,310],{},"MemberData(nameof(IEnumerable\u003Cobject>",[235,312,313],{},"In the example below we are using a method to return data to be used (however this method could also read data from other files such as text or excel to be returned)",[235,315,316,317],{},"approach to pass data into the test method\n",[173,318,320],{"href":319},"\u002Farticles\u002Fimages\u002FSNAGHTML2e5bc0f5_636767597904435811.png",[300,321],{"style":302,"title":322,"src":323,"alt":322,"width":324,"height":325,"border":307},"SNAGHTML2e5bc0f5","\u002Farticles\u002Fimages\u002FSNAGHTML2e5bc0f5_thumb_636767597905425086.png",484,226,[235,327,328],{},"xUnit runs it’s tests in parallel to take advantage of today’s processors",[235,330,331],{},"tests within one class are run serial",[235,333,334],{},"tests in multiple classes are run parallel",[235,336,337,338,341],{},"can be disabled by creating a test collection (add attribute ",[245,339,340],{},"Collection({name})",", and all within the same collection will be run serial",[235,343,344],{},"in order to test that an exception is thrown",[235,346,347,348],{},"Assert.Throws\u003CInvalidOperationException>(() => ThrowAnError());\n",[173,349,351],{"href":350},"\u002Farticles\u002Fimages\u002Fimage_636767597907208471.png",[300,352],{"style":302,"title":353,"src":354,"alt":353,"width":355,"height":356,"border":307},"image","\u002Farticles\u002Fimages\u002Fimage_thumb_636767597908147368.png",452,301,[235,358,359],{},"Setup\u002FTeardown",[235,361,362,363,63,366,369],{},"There are no ",[245,364,365],{},"Setup",[245,367,368],{},"Teardown"," attributes, this is done using the test class’ constructor and an IDisposable. This encourages developers to write cleaner tests.",[235,371,372],{},"use constructor in place of Setup attributes to prepare tests",[235,374,375],{},"now use IDisposable to replace teardown i.e. public class ATestClass : IDisposable\npublic void Dispose() {\n   \u002F\u002Fsomething here to clean up\n}",[235,377,378,379],{},"for input\u002Foutput there exists ITestOutputHelper as shown below to output log\n",[173,380,382],{"href":381},"\u002Farticles\u002Fimages\u002Fimage_636767597909423747.png",[300,383],{"style":302,"title":353,"src":384,"alt":353,"width":385,"height":386,"border":307},"\u002Farticles\u002Fimages\u002Fimage_thumb_636767597910292790.png",447,240,[12,388,389],{},"Notes",[232,391,392,395],{},[235,393,394],{},"Works in .net core and .net framework",[235,396,397,398,401],{},"TODO: Read up on Live Unit Testing ",[173,399],{"title":400,"href":400},"https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fvisualstudio\u002Ftest\u002Flive-unit-testing?view=vs-2017",[173,402,400],{"href":400,"rel":403},[179],[12,405,406],{},"References:",[408,409,410,411,414,415,418,419,414,422],"blockquote",{},"  \n",[173,412,413],{"title":413,"href":413},"https:\u002F\u002Fxunit.github.io\u002Fdocs\u002Fwhy-did-we-build-xunit-1.0.html"," \n",[173,416,417],{"title":417,"href":417},"https:\u002F\u002Fdev.to\u002Fhatsrumandcode\u002Fnet-core-2-why-xunit-and-not-nunit-or-mstest--aei","   \n",[173,420,421],{"title":421,"href":421},"https:\u002F\u002Fchannel9.msdn.com\u002FShows\u002FVisual-Studio-Toolbox\u002FUnit-Testing-xUnit",[173,423,424],{"title":424,"href":424},"https:\u002F\u002Fxunit.github.io\u002F",{"title":190,"searchDepth":191,"depth":191,"links":426},[],"2018-11-02T12:49:51.111Z","Primarily XUnit leverages some new features to help developers write cleaner test, as tests should be kept clean and treated as first-class citizens.",{},"\u002Farticles\u002Fxunit-what-is-it-and-why-another-unit-testing-framework",{"title":222,"description":428},"articles\u002Fxunit-what-is-it-and-why-another-unit-testing-framework",[203,434],"testing","Xa57WSBlnynbn4MUPddzdtkn0rAmRbojbJ2tqgZD33w",{"id":437,"title":438,"author":7,"body":439,"createdAt":488,"description":489,"extension":195,"img":470,"meta":490,"navigation":198,"path":491,"seo":492,"stem":493,"tags":494,"updatedAt":488,"__hash__":496},"articles\u002Farticles\u002Fteam-foundation-2018-tfs-net-core-command.md","Team Foundation 2018 TFS .NET Core Command",{"type":9,"value":440,"toc":486},[441,444,447,450,463,472],[12,442,443],{},"Using command dotnet push I was wanting to only publish nuget packages that included *.nupkg but also exclude *.symbols.nupkg pattern.",[12,445,446],{},"I figured okay, I would use option to negate a particular path. Using the help guidance",[12,448,449],{},"The pattern to match or path to nupkg files to be uploaded. Multiple patterns can be separated by a semicolon, and you can make a pattern negative by prefixing it with '-:'.",[12,451,452,453,460,462],{},"Example: ",[48,454,455,456],{},"\u002F",[457,458,459],"em",{},".nupkg;-:",[457,461,455],{},".Tests.nupkg",[12,464,465],{},[173,466,468],{"href":467},"\u002Farticles\u002Fimages\u002Fimage_636764987271419965.png",[300,469],{"style":302,"title":353,"src":470,"alt":353,"width":386,"height":471,"border":307},"\u002Farticles\u002Fimages\u002Fimage_thumb_636764987272194490.png",118,[12,473,474,475,477,478,485],{},"The issue is that this is incorrect.  If you wish to pattern negative prefix with ! (with semi-colon for make delimited) such as",[181,476],{},"\n$(Build.ArtifactStagingDirectory)\u002F",[457,479,480,481,484],{},".nupkg",[48,482,483],{},";!","$(Build.ArtifactStagingDirectory)\u002F",".symbols.nupkg",{"title":190,"searchDepth":191,"depth":191,"links":487},[],"2018-10-30T12:18:47.314Z","The dotnet pack command builds the project and creates NuGet packages. Careful with configuration and specifically negative file pattern matching documentation(incorrect).",{},"\u002Farticles\u002Fteam-foundation-2018-tfs-net-core-command",{"title":438,"description":489},"articles\u002Fteam-foundation-2018-tfs-net-core-command",[495],"teamfoundationserver","_MZCZimFHc2iJo_tCF1mvmKFsazly7CiZo31fvpUqzE",1781465430484]