Subscribe: Latest Microsoft Blogs
http://weblogs.asp.net/aspnet-team/rss.aspx
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
add  app  build  core  csproj  dotnet  file  json  make  net core  net  new  nuget  scott hanselman  test  visual studio 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Latest Microsoft Blogs

Untitled





 



Command Line: Using dotnet watch test for continuous testing with .NET Core 1.0 and XUnit.net

Mon, 27 Mar 2017 04:28:03 GMT

I've installed .NET Core 1.0 on my machine. Let's see if I can get a class library and tests running and compiling automatically using only the command line. (Yes, some of you are freaked out by my (and other folks') appreciation of a nice, terse command line. Don't worry. You can do all this with a mouse if you want. I'm just enjoying the CLI. NOTE: This is considerably updated from the project.json version in 2016. First, I installed from http://dot.net/core. This should all work on Windows, Mac, or Linux.C:\> md testexample & cd testexampleC:\testexample> dotnet new slnContent generation time: 33.0582 msThe template "Solution File" created successfully.C:\testexample> dotnet new classlib -n mylibrary -o mylibraryContent generation time: 40.5442 msThe template "Class library" created successfully.C:\testexample> dotnet new xunit -n mytests -o mytestsContent generation time: 87.5115 msThe template "xUnit Test Project" created successfully.C:\testexample> dotnet sln add mylibrary\mylibrary.csprojProject `mylibrary\mylibrary.csproj` added to the solution.C:\testexample> dotnet sln add mytests\mytests.csprojProject `mytests\mytests.csproj` added to the solution.C:\testexample> cd mytestsC:\testexample\mytests> dotnet add reference ..\mylibrary\mylibrary.csprojReference `..\mylibrary\mylibrary.csproj` added to the project.C:\testexample\mytests> cd ..C:\testexample> dotnet restore Restoring packages for C:\Users\scott\Desktop\testexample\mytests\mytests.csproj... Restoring packages for C:\Users\scott\Desktop\testexample\mylibrary\mylibrary.csproj... Restore completed in 586.73 ms for C:\Users\scott\Desktop\testexample\mylibrary\mylibrary.csproj. Installing System.Diagnostics.TextWriterTraceListener 4.0.0....SNIP... Installing Microsoft.NET.Test.Sdk 15.0.0. Installing xunit.runner.visualstudio 2.2.0. Installing xunit 2.2.0. Generating MSBuild file C:\Users\scott\Desktop\testexample\mytests\obj\mytests.csproj.nuget.g.props. Generating MSBuild file C:\Users\scott\Desktop\testexample\mytests\obj\mytests.csproj.nuget.g.targets. Writing lock file to disk. Path: C:\Users\scott\Desktop\testexample\mytests\obj\project.assets.json Installed: 16 package(s) to C:\Users\scott\Desktop\testexample\mytests\mytests.csprojC:\testexample> cd mytests & dotnet testBuild started, please wait...Build completed.Test run for C:\testexample\mytests\bin\Debug\netcoreapp1.1\mytests.dll(.NETCoreApp,Version=v1.1)Microsoft (R) Test Execution Command Line Tool Version 15.0.0.0Copyright (c) Microsoft Corporation. All rights reserved.Starting test execution, please wait...[xUnit.net 00:00:00.5539676] Discovering: mytests[xUnit.net 00:00:00.6867799] Discovered: mytests[xUnit.net 00:00:00.7341661] Starting: mytests[xUnit.net 00:00:00.8691063] Finished: mytestsTotal tests: 1. Passed: 1. Failed: 0. Skipped: 0.Test Run Successful.Test execution time: 1.8329 SecondsOf course, I'm testing nothing yet but pretend there's a test in the tests.cs and something it's testing (that's why I added a reference) in the library.cs, OK? Now I want to have my project build and tests run automatically as I make changes to the code. I can't "dotnet add tool" yet so I'll add this line to my test's project file: Like this: Then I just dotnet restore to bring in the tool. In order to start the tests, I don't write dotnet test, I run "dotnet watch test." The main command is watch, and then WATCH calls TEST. You can also dotnet watch run, etc.NOTE: There's a color bug using only cmd.exe so on "DOS" you'll see some ANSI chars. That should be fixed in a minor release soon - the PR is in and waiting. On bash or PowerShell things look fin.In this screenshot, you can see as I make changes to my test and hit save, the DotNetWatcher Tool sees the change and restarts my app, recompiles, and re-runs the tests. All this was done from the command line. I made a solution file, made a library project [...]



Visual Studio 2017 can automatically recommend NuGet packages for unknown types

Fri, 24 Mar 2017 08:03:31 GMT

There's a great feature in Visual Studio 2015.3 and Visual Studio 2017 that is turned off by default. It does use about ~10 megs of memory but it makes me so happy that I turn it on. It's under C# | Advanced in Tools Options. Or you can just type "Advanced" in the Quick Launch Bar (via Ctrl+Q if you like) to jump there. I turn on "Suggest usings for types in NuGet packages" and "Suggest usings for types in reference assemblies." For example, if I am typing some code and start referencing a Type that isn't in my project but could be...you know how sometimes you just need a using statement to bring in a namespace? In this Web App, I already have Json.NET so it recommends a using statement to bring it into scope. But in this Console App, I have no packages beyond the defaults. When I start using a type like JObject from a popular NuGet, Visual Studio can offer to install Json.NET for me! Or another example: And then I can immediately continue typing with intellisense. If I know what I'm doing, I can bring in something like this without ever using the mouse or leaving the line. Good stuff!  Sponsor: Check out JetBrains Rider: a new cross-platform .NET IDE. Edit, refactor, test, build and debug ASP.NET, .NET Framework, .NET Core, or Unity applications. Learn more and get access to early builds!© 2017 Scott Hanselman. All rights reserved.      [...]



DocumentDB Stored Procedures Best Practices

Thu, 23 Mar 2017 21:00:00 GMT

Andrew Liu joins Scott Hanselman to talk about Azure DocumentDB's language integrated, transactional execution of JavaScript, which enables developers write stored procedures, triggers and user defined functions (UDFs) natively in JavaScript. Andrew also shares best practices for writing these stored procedures.

(image) Andrew Liu joins Scott Hanselman to talk about Azure DocumentDB's language integrated, transactional execution of JavaScript, which enables developers write stored procedures, triggers and user defined functions (UDFs) natively in JavaScript. Andrew also shares best practices for writing these stored procedures.


Media Files:
http://video.ch9.ms/ch9/a804/1d12263e-fd89-41c3-a0d4-7e8f08b7a804/DocumentDBStoredProcedures.mp4




Notes from the ASP.NET Community Standup –March 21, 2017

Wed, 22 Mar 2017 17:21:17 +0000

  This is the next in a series of blog posts that will cover the topics discussed in the ASP.NET Community Standup. The community standup is a short video-based discussion with some of the leaders of the ASP.NET development teams covering the accomplishments of the team on the new ASP.NET Core framework over the previous... Read more



Temporary Post Used For Theme Detection (a8652ecc-cdf5-4745-96f3-d9c320c67551 – 3bfe001a-32de-4114-a6b4-4005b770f6d7)

Tue, 21 Mar 2017 17:29:46 +0000

This is a temporary post that was not deleted. Please delete this manually. (cc465c0d-888f-4db5-9662-e1ba4d975be5 – 3bfe001a-32de-4114-a6b4-4005b770f6d7)



Five Visual Studio 2017 Extensions for Web Developers

Tue, 21 Mar 2017 16:05:25 +0000

You’ve downloaded and installed Visual Studio 2017, and it’s a great improvement over previous versions.  Now what?  How can you make your web development experience better?  In this article, we will recommend five Visual Studio extensions that will make your day-to-day tasks easier and even more enjoyable. Razor Language Service When you’re building ASP.NET Core... Read more



Options for CSS and JS Bundling and Minification with ASP.NET Core

Sat, 18 Mar 2017 00:10:11 GMT

Maria and I were updating the NerdDinner sample app (not done yet, but soon) and were looking at various ways to do bundling and minification of the JSS and CS. There's runtime bundling on ASP.NET 4.x but in recent years web developers have used tools like Grunt or Gulp to orchestrate a client-side build process to squish their assets. The key is to find a balance that gives you easy access to development versions of JS/CSS assets when at dev time, while making it "zero work" to put minified stuff into production. Additionally, some devs don't need the Grunt/Gulp/npm overhead while others absolutely do. So how do you find balance? Here's how it works. I'm in Visual Studio 2017 and I go File | New Project | ASP.NET Core Web App. Bundling isn't on by default but the configuration you need IS included by default. It's just minutes to enable and it's quite nice. In my Solution Explorer is a "bundleconfig.json" like this:// Configure bundling and minification for the project.// More info at https://go.microsoft.com/fwlink/?LinkId=808241[ { "outputFileName": "wwwroot/css/site.min.css", // An array of relative input file paths. Globbing patterns supported "inputFiles": [ "wwwroot/css/site.css" ] }, { "outputFileName": "wwwroot/js/site.min", "inputFiles": [ "wwwroot/js/site" ], // Optionally specify minification options "minify": { "enabled": true, "renameLocals": true }, // Optionally generate .map file "sourceMap": false }]Pretty simple. Ins and outs. At the top of the VS editor you'll see this yellow prompt. VS knows you're in a bundleconfig.json and in order to use it effectively in VS you grab a small extension. To be clear, it's NOT required. It just makes it easier. The source is at https://github.com/madskristensen/BundlerMinifier. Slip this UI section if you just want Build-time bundling.If getting a prompt like this bugs you, you can turn all prompting off here:Look at your Solution Explorer. See under site.css and site? There are associated minified versions of those files. They aren't really "under" them. They are next to them on the disk, but this hierarchy is a nice way to see that they are associated, and that one generates the other.Right click on your project and you'll see this Bundler & Minifier menu:You can manually update your Bundles with this item as well as see settings and have bundling show up in the Task Runner Explorer.Build Time MinificationThe VSIX (VS extension) gives you the small menu and some UI hooks, but if you want to have your bundles updated at build time (useful if you don't use VS!) then you'll want to add a NuGet package called BuildBundlerMinifier.You can add this NuGet package SEVERAL ways. Which is awesome.Add it from the Manage NuGet Packages menuAdd it from the command line via "dotnet add package BuildBundlerMinifier"Note that this adds it to your csproj without you having to edit it! It's like "nuget install" but adds references to projects!  The dotnet CLI is lovely.If you have the VSIX installed, just right-click the bundleconfig.json and click "Enable bundle on build..." and you'll get the NuGet package.Now bundling will run on build...c:\WebApplication8\WebApplication8>dotnet buildMicrosoft (R) Build Engine version 15Copyright (C) Microsoft Corporation. All rights reserved. Bundler: Begin processing bundleconfig.json Bundler: Done processing bundleconfig.json WebApplication8 -> c:\WebApplication8\bin\Debug\netcoreapp1.1\WebApplication8.dllBuild succeeded. 0 Warning(s) 0 Error(s)...even from the command line with "dotnet build." It's all integrated. This is nice for VS Code or users of other editors. Here's how it would work entirely from the command prompt:$ dotnet new mvc$ dotnet add package BuildBundlerMinifier$ dotnet restore$ dotnet runAdvanced: Using Gulp to handle Bundling/MinifyingIf you outgrow this bundler or just like Gulp[...]



Easy Push Notifications with Azure App Service

Thu, 16 Mar 2017 20:06:16 GMT

Adrian Hall joins Scott Hanselman to explain the new features and demo push notifications in Azure App Service, which is a secure way to use Azure Mobile Apps to integrate mobile apps with Azure Notification Hubs to receive push notifications.

(image) Adrian Hall joins Scott Hanselman to explain the new features and demo push notifications in Azure App Service, which is a secure way to use Azure Mobile Apps to integrate mobile apps with Azure Notification Hubs to receive push notifications.


Media Files:
http://video.ch9.ms/ch9/3a98/c7326d6c-6bda-44c5-8a11-73f8949c3a98/EasyPushNotificationswithAzureAppService.mp4




Extending the Common Data Service Base Schema in PowerApps

Thu, 16 Mar 2017 20:00:00 GMT

Arif Kureshy joins Scott Hanselman to show how to extend the Common Data Service (CDS) base schema for custom scenarios. CDS ships with over 65 standard entity sets that you can use to build apps for many common scenarios.

(image) Arif Kureshy joins Scott Hanselman to show how to extend the Common Data Service (CDS) base schema for custom scenarios. CDS ships with over 65 standard entity sets that you can use to build apps for many common scenarios.


Media Files:
http://video.ch9.ms/ch9/c20e/93163454-bb4a-4989-9d04-cc44f185c20e/CDSExtendBaseScheme.mp4




ZEIT now deployments of open source ASP.NET Core web apps with Docker

Wed, 15 Mar 2017 20:13:41 GMT

ZEIT is a new cloud service and "now" is the name of their deployment tool. ZEIT World is their DNS service. If you head over to https://zeit.co/ you'll see a somewhat cryptic animated gif that shows how almost impossibly simple it is to deploy a web app with ZEIT now. You can make a folder, put an index.html (for example) in it and just run "now." You'll automatically get a website with an autogenerated name and it'll be live. It's probably the fastest and easiest deploy I've ever seen. Remember when Heroku (then Azure, then literally everyone) started using git for deployment? Clearly being able to type "now" and just get a web site on the public internet was the next step. (Next someone will make "up" which will then get replaced with just pressing ENTER on an empty line! ;) ) Jokes aside, now is clean and easy. I appreciate their organizational willpower to make an elegant and simple command line tool. I suspect it's harder than it looks to keep things simple. All of their examples use JavaScript and node, but they also support Docker, which means they support open source ASP.NET Core on .NET Core! But do they know they do? ;) Let's find out. And more importantly, how easy is it? Can I take a site from concept to production in minutes? Darn tootin' I can. First, make a quick ASP.NET Core app. I'll use the MVC template with Bootstrap.C:\Users\scott\zeitdotnet>dotnet new mvcContent generation time: 419.5337 msThe template "ASP.NET Core Web App" created successfully.I'll do a quick dotnet restore to get the packages for my project.C:\Users\scott\zeitdotnet>dotnet restore Restoring packages for C:\Users\scott\zeitdotnet\zeitdotnet.csproj... Generating MSBuild file C:\Users\scott\zeitdotnet\obj\zeitdotnet.csproj.nuget.g.props. Generating MSBuild file C:\Users\scott\zeitdotnet\obj\zeitdotnet.csproj.nuget.g.targets. Writing lock file to disk. Path: C:\Users\scott\zeitdotnet\obj\project.assets.json Restore completed in 2.93 sec for C:\Users\scott\zeitdotnet\zeitdotnet.csproj. NuGet Config files used: C:\Users\scott\AppData\Roaming\NuGet\NuGet.Config C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config Feeds used: https://api.nuget.org/v3/index.json C:\LocalNuGet C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\Now I need to add a Dockerfile. I'll make one in the root that looks like this:FROM microsoft/aspnetcoreLABEL name="zeitdotnet"ENTRYPOINT ["dotnet", "zeitdotnet.dll"]ARG source=.WORKDIR /appEXPOSE 80COPY $source .Note that I could have ZEIT build my app for me if I used the aspnetcore Dockerfile that includes the .NET Core SDK, but that would not only make my deployment longer, it would also make my docker images a LOT larger. I want to include JUST the .NET Core runtime in my image, so I'll build and publish locally.ZEIT now is going to need to see my Dockerfile, and since I want my app to include the binaries (I don't want to ship my source in the Docker image up to ZEIT) I need to mark my Dockerfile as "Content" and make sure it's copied to the publish folder when my app is built and published. Always I'll add this my project's csproj file. If I was using Visual Studio, this is the same as right clicking on the Properties of the Dockerfile, setting it to Content and then "Always Copy to Output Directory." Now I'll just build and publish to a folder with one command:C:\Users\scott\zeitdotnet>dotnet publishMicrosoft (R) Build Engine version 15.1.548.43366Copyright (C) Microsoft Corporation. All rights reserved. zeitdotnet -> C:\Users\scott\zeitdotnet\bin\Debug\netcoreapp1.1\zeitdotnet.dllA[...]



DocumentDB: API for MongoDB now generally available

Wed, 15 Mar 2017 10:30:07 Z

Today, we are excited to announce that DocumentDB’s API for MongoDB is generally available. The API for MongoDB allows developers to experience the power of the DocumentDB database engine with the comfort of a managed service and the familiarity of the MongoDB SDKs and tools.



Notice for developers using Azure AD B2C tenants configured for Google sign-ins

Tue, 14 Mar 2017 11:00:07 Z

On April 20th 2017, Google will start blocking OAuth requests from embedded browsers, called "web-views". If you are using Google as an identity provider in Azure Active Directory B2C, you might need to make changes to your applications to avoid downtime.



Notes from the ASP.NET Community Standup –March 9, 2017

Mon, 13 Mar 2017 19:41:17 +0000

This is the next in a series of blog posts that will cover the topics discussed in the ASP.NET Community Standup. The community standup is a short video-based discussion with some of the leaders of the ASP.NET development teams covering the accomplishments of the team on the new ASP.NET Core framework over the previous week.... Read more



Nintendo Switch and The Legend of Zelda: Breath of the Wild are an ABSOLUTE JOY

Sun, 12 Mar 2017 02:15:18 GMT

I bought a Nintendo Switch last week with my allowance and I'm utterly smitten. It's brilliant. It's absolutely brilliant. Now, to be clear, I'm neither a hardcore gamer nor a journalist. However, I am someone who grew up on Mario, enjoys Retrogaming and my Xbox One, and most of all, I know genius when I see it. The Legend of Zelda: Breath of the Wild is a wonderful example of the very best that video games can offer as an art form in 2017. - Me It may be the best video game ever. And it is because it borrows so much from the decades of refinement whose shoulders it stands upon. Let's break this down into two halves. First, Zelda (which is available on WiiU and Switch), and later, the Switch itself. If you don't feel like reading this, just trust me and buy a Switch and Zelda and bask in the hundreds of hours of joy and wonder it will bring you. It's the most fun I've had with a video game in recent memory. I also profoundly recommend the gorgeous hardcover The Legend of Zelda: Breath of the Wild: The Complete Official Guide Collector's Edition. The maps, the art, and the gentle walkthroughs are more fun than googling. The kids and I have enjoyed exploring the wilderness with the giant map unfurled in front of us. Legend of Zelda: Breath of the Wild It's HUGE. It's estimated at 360 square kilometers. They are saying it's 1.5x the Skyrim map and may be larger than Witcher 3. A cynic could call Breath of the Wild derivative, but an optimist like me says, well, they stole every game mechanic that was awesome over the last few decades, and made the near-perfect game. I love that this is a console launch game that is polished and has at LEAST 100 hours or more for the completist. What is Zelda like? Just Cause - Fly off a cliff with a paraglider, fly over a raging river and land on an elk, tame it and ride it. Because you're awesome and you can. Witcher 3 - Massive map, armor sets, crafting and more. Assassin's Creed - Climbing because...it's fun. Getting maps by unlocking towers and jumping off. Grand Theft Auto - The first massive sandbox without loading. You enter a new area and get a brief subtitle announcing you're in a new "neighborhood" and then you wander. Skyrim - The Elder Scrolls was the first video game I played where I climbed mountains "because they were there" and really had a sense of wonder when I got to the top. Draw distance! Shadow of the Colossus - There's amazing HUGE boss fights that involve climbing the enemy, racing after monsters with horses, and sometimes going inside them. Bard's Tale - Because I'm old. Complaints? Honestly, if I had to truly nit. And I mean really nit I'd say the durability of weapons, particularly swords, is annoying. I would make them last maybe 50% longer. Also, moving in and out of Shrines has a load screen that takes 10-15 seconds. But really, that's like saying "I wish Beyoncé was 5'8", not 5'7". I mean, REALLY. Beyoncé. Shush. The Nintendo Switch It's portable. Just like in the ad, you can pull the Switch out and leave. In my video below I also switch to portable AND have to re-sync the controllers, so there is one additional ceremony, but it's easy. Short #video of my #nintendoswitch playing Zelda going from big screen to portable and back. pic.twitter.com/3a2yPtz01w— Scott Hanselman (@shanselman) March 5, 2017 It feels like a console when it's plugged in. I've got it plugged into my TV and from my couch it looks as nice as any of my devices. Sure, it's not an Xbox One playing Tom Clancy: The Division. But it's a brilliant tradeoff for a device I can simply pick up and go outside with (which I've done, with considerable appreciation.) I'm surprised that folks are complaining about the gaming resolution, fra[...]



Fritz’s 10 Minute Tips – ASP.NET Core Configuration

Fri, 10 Mar 2017 20:32:19 +0000

I recorded another short video to show the various ways that you can configure an ASP.NET Core application. In the video, I show how to configure your application with: Strongly-typed configuration classes appsettings.json environment variables environment variables in web.config user-secrets Interested in seeing more sample videos like this?  I have more ideas and demos that […]