Subscribe: Scott Hanselman's Computer Zen
Added By: Feedage Forager Feedage Grade A rated
Language: English
arcade  core  dotnet  framework  images  microsoft  net core  net standard  net  new  samples  standard  visual studio  windows 
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: Scott Hanselman's Computer Zen

Scott Hanselman's Blog

Scott Hanselman on Programming, User Experience, The Zen of Computers and Life in General


Solved: Surface Pro 3 USB Driver Issues with the Surface Diagnostic Toolkit

Wed, 21 Jun 2017 18:56:42 GMT

I've got a personal Surface Pro 3 that I like very much. It's worked great for years and I haven't had any issues with it. However, yesterday while installing a 3rd party USB device something got goofed around with the drivers and I ended up in this state. That "banged out" device in my Device Manager is the root Universal Serial Bus (USB) Controller for the Surface. That means everything  USB didn't work since everything USB hangs off that root device node. I know it's an Intel USB 3.0 xHCI Host Controller but I didn't want to go installing random Intel Drivers. I just wanted the Surface back the way it was, working, with the standard drivers. I tried the usual stuff like Uninstalling the Device and rebooting, hoping Windows would heal it but it didn't work. Because the main USB device was dead that meant my Surface Type Keyboard didn't work, my mouse didn't work, nothing. I had to do everything with the touchscreen. After a little poking around on Microsoft Support websites, a friend turned me onto the "Surface Tools for IT." These are the tools that IT Departments use when they are rolling out a bunch of Surfaces to an organization and they are regularly updated. In fact, these were updated just yesterday! There are a number of utilities you can check out but the most useful is the Surface Diagnostic Toolkit. It checks hardware and software versions and found a number of little drivers things wrong...and fixed them. It reset my USB Controller and put in the right driver and I'm back in business. This util was useful enough to me that I wish it had been installed by default on the Surface and plugged into the built-in Windows Troubleshooting feature. Sponsor: Seq is simple centralized logging, on your infrastructure, with great support for ASP.NET Core and Serilog. Version 4 adds integrated dashboards and alerts - check it out!© 2017 Scott Hanselman. All rights reserved.       [...]

Get Solarized - Awesome command prompt colors for VS, VS Code, cmd, PowerShell, and more

Sat, 17 Jun 2017 00:22:29 GMT

I was on a call with my co-worker Maria today and she commented on how nice my command prompt in Windows looked. I told it was "Solarized" and then our conference call fell apart as we collected all kinds of fun info about how you can get Solarized in your favorite apps on Windows. Solarized is a sixteen color palette (eight monotones, eight accent colors) designed for use with terminal and gui applications. It's by Ethan Schoonover and it's spread all over the web. You can see screenshots and learn about it on GitHub. Solarized for your Windows Command Prompt (cmd, powershell, bash) By default when you right click and hit properties on a shortcut for a prompt like cmd, powershell, or bash, you'll get a dialog that looks like this. You'll see there's 16 colors, usually 8 colors on the left, and then the "light/intense/bold" version of each color on the right. I usually used Intense Terminal Green on black before Solarized. Those values (the defaults) are stored in the registry here HKEY_CURRENT_USER\Console Those defaults are used for NEW shortcuts or consoles that start afresh, via Windows+R. This won't change existing shortcuts you may already have created. There's a few ways to fix this. I've found the easiest manual way is to recreate the shortcuts. You can do this by just copy-pasting a shortcut and using the new one. However, there is talk of programmatically updating .lnk (Start Menu link files) with PowerShell. You'd just go to the location of each LNK file you want to change, then run Update-Link.ps1 YOURLINK.LNK "light|dark" and it'll load up the .lnk file using Windows APIs and save it with a new Color Table. I've started that work here and I'll PR the main repo if I can solve one issue - I can't get it to switch to Solarized Light, just Dark. It might be something wrong on my side. Please take a look if you're a Win32/PowerShell internals type. Here I went to where the Start Menu stores most of the LNK files. You can also search for an item in your start and right-click "Open File Location."pow Here's before and after with my Developer Command Prompt for Visual Studio 2015. NOTE: Once this is done, in cmd.exe you can also switch between light and dark with "color f6" or "color 01" which is nice for presentations. I'm not sure how to do this yet in PowerShell or Bash. Here is the palette after: For PowerShell there is also an extra-step you'll want to put into your Microsoft.PowerShell_profile.ps1 where you map things like Errors, Progress Bars, and Warnings internally in PowerShell. Be sure to read the instructions. Solarized in Visual Studio and Visual Studio Code As for Visual Studio and Visual Studio Code, they're far easier. You can just Ctrl-K then Ctrl-T in VSCode and pick Solarized. For Visual Studio (all versions) you can head over to @leddt's GitHub and download settings files for Solarized that you can then import info VS from Tools | Import and Export Settings. Sponsor: Big thanks to Raygun! Don't rely on your users to report the problems they experience. Automatically detect, diagnose and understand the root cause of errors, crashes and performance issues in your web and mobile apps. Learn more. © 2017 Scott Hanselman. All rights reserved.       [...]

How to reference a .NET Core library in WinForms - Or, .NET Standard Explained

Fri, 16 Jun 2017 07:13:44 GMT

I got an interesting email today. The author said "I have a problem consuming a .net core class library in a winforms project and can't seem to find a solution." This was interesting for a few reasons. First, it's solvable, second, it's common, and third, it's a good opportunity to clear a few things up with a good example. To start, I emailed back with "precision questioning." I needed to assert my assumptions and get a few very specific details to make sure this was, in fact, possible. I said. "What library are you trying to use? What versions of each side (core and winforms)? What VS version?" The answer was "I am working with VS2017. The class library is on NETCoreApp 1.1 and the app is a Winforms project on .NET Framework 4.6.2." Cool! Let's solve it. Referencing a .NET Core library from WinForms (running .NET Full Framework) Before we parse this question. Let's level-set. .NET is this big name. It's the name for the whole ecosystem, but it's overloaded in such a way that someone can say "I'm using .NET" and you only have a general idea of what that means. Are you using it on mobile? in docker? on windows? Let's consider that ".NET" as a name is overloaded and note that there are a few "instances of .NET" .NET (full) Framework - Ships with Windows. Runs ASP.NET, WPF, WinForms, and a TON of apps on Windows. Lots of businesses depend on it and have for a decade. Super powerful. Non-technical parent maybe downloads it if they want to run or a game. .NET Core - Small, fast, open source, and cross-platform. Runs not only on Windows but also Mac and a dozen flavors of Linux. Xamarin/Mono/Unity - The .NET that makes it possible to write apps in C# or F# and run them on everything from an iPad to cheap Android phone to a Nintendo Switch. All of these runtimes are .NET. If you learn C# or F# or VB, you're a .NET Programmer. If you do a little research and google around you can write code for Windows, Mac, Linux, Xbox, Playstation, Raspberry Pi, Android, iOS, and on and on. You can run apps on Azure, GCP, AWS - anywhere. What's .NET Standard? .NET Standard isn't a runtime. It's not something you can install. It's not an "instance of .NET."  .NET Standard is an interface - a versioned list of APIs that you can call. Each newer version of .NET Standard adds more APIs but leaves older platforms/operating systems behind. The runtimes then implement this standard. If someone comes out with a new .NET that runs on a device I've never heard of, BUT it "implements .NET Standard" then I just learned I can write code for it. I can even use my existing .NET Standard libraries. You can see the full spread of .NET Standard versions to supported runtimes in this table. Now, you could target a runtime - a specific .NET - or you can be more flexible and target .NET Standard. Why lock yourself down to a single operating system or specific version of .NET? Why not target a list of APIs that are supported on a ton of platforms? The person who emailed me wanted to "run a .NET Core Library on WinForms." Tease apart that statement. What they really want is to reuse code - a dll/library specifically. When you make a new library in Visual Studio 2017 you get these choices. If you're making a brand new library that you might want to use in more than one place, you'll almost always want to choose .NET Standard. .NET Standard isn't a runtime or a platform. It's not an operating system choice. .NET Standard is a bunch of APIs. Next, check properties and decide what version of .NET Standard you need. The .NET Core docs are really quite good, and the API browser is awesome. You can find them at  The API browser has all the .NET Standard APIs versioned. You can put the version in the URL if you like, or use this nice interface. You can check out .NET Standard 1.6, for example, and see all the namespaces and methods it supports. It works on Windows 10, .NET Framework 4.6.1 a[...]

LLBLGen Pro for .NET and .NET Core - Database Entity Modeling with any ORM

Mon, 12 Jun 2017 05:57:50 GMT

There's opinionated frameworks, and then there's opinionated frameworks that also respect your opinion. LLBLGen is one of those. For many years it's been a great entity modeling tool as well as an excellent ORM (Object Relational Mapper.) It also supports all major ORMs in the .NET space like Entity Framework, NHibernate, Linq to Sql as well as, of course, their own included LLBLGen Pro Runtime Framework. It works with VS2015 and VS2017 and is actively supported and extremely actively developed. It's because of that active development that I wanted to check it out. It's got Getting Started videos and a TON of docs, so I figured I could do some damage pretty quickly with a 30 day trial. NOTE: Just a reminder, I don't do sponsored posts for software. I just felt like checking out LLBLGen because it's been a few years since I looked at it least. All my observations are my own, unfiltered, as I know you like them, Dear Reader. You can do Database First - a technique that is crucial for so many of us with existing databases but often downplayed with other ORMs - as well as Model First and then generate classes. I decided to start with one of the newer SQL Server 2016 sample databases called Worldwide Importers. There's localdb versions, Azure SQL Database versions, and SQL Server 2016 backups. I made a database in Azure, uploaded a "bacpac" file to Azure storage, and imported the database into SQL Azure. Although I certainly could have done the work locally, I can get more horsepower in the cloud. When I make a new Project in the LLBLGen GUI I can pick from a ton of different ORMs including 5 (!) versions of Entity Framework including EFCore, as well as NHibernate 4v and Linq to SQL (which is a nice touch as I have two L2S projects still in production.) The WorldWide Importers sample is a nice one as it's typical and non-trivial in complexity. I pointed LLBLGen at it and let it rip. Make sure you wait until your database is totally restored into SQL Azure or your SQL Server or you may get weird errors about Zombie Transactions. When it's done, you'll get an Errors & Warnings pane that will tell you how many stored procs, tables, views, etc that were imported, and that they are "unmapped," which is cool since you haven't mapped them. You can switch your Target ORM Framework after you've imported your Data Model, but you really should put a little thought into how your database is structured and whether or not your preferred ORM supports all the features you (may) have used heavily in your Database. For example, if you're a very "stored proc"-style shop, it would be a problem if you really wanted to use an ORM that didn't support stored procs. LLBLGen is rather extraordinary in that it not only has smarts about what's possible and what's not, but it also offers you a multiple-choice solution framework when something is wrong. For example, there's a mapping here that isn't support, so it's offering me three options to fix it, including (of course) changing the offending entity by changing/adding fields. Once you have a valid model and have corrected any issues and/or made appropriate changes, you can Generate Source Code for your target platform, language, and ORM Framework. Make no mistake about it - there's a LOT of depth here. There's multiple kinds of templates and tons of options. You may not get it all right on the first try, but it's very forgiving. Just remember where the authoritative source of truth is. Is your model the truth? Or your database? As you move forward (depending on where you started) your source of truth will likely change. You can use any of the many code generators or expand them with your own modifications and metadata. You'll also likely get addicted to the nice visual editors for entities (a good thing!). Quick Model is also nice if you want to visualize (and change) relationships between just a few of your many tables. If you get fast enough, with practice you can use the Quick Model editor and it's Command[...]

Trying .NET Core on Linux with just a tarball (without apt-get)

Thu, 08 Jun 2017 17:33:22 GMT

There's a great post on the .NET Blog about the crazy Performance Improvements in .NET Core that ended up on Hacker News. The top comment on HN is a great one that points out that the  website could be simpler, that it could be a one-pager with a clearer Getting Started experience. They also said this: Also, have a simple downloadable .tar.gz which expands into /bin + /lib + /examples. I loved C# back in my Windows days and I moved to Linux to escape Microsoft complexities and over-reliance on complex IDEs and tools, scattered like shrapnel all over my c:/ I will not run apt-get against your repo without knowing ahead of time what I'm getting and where will it all go, so let me play with the tarball first. This is a great point, and we're going to look at revamping and simplifying the with this in mind in the next few weeks. They're saying that the Linux instructions, like these instructions on installing .NET Core on Ubuntu for example, make you trust a 3rd party apt repro and apt-get .NET, while they want a more non-committal option. This gets to the larger "the website is getting bigger than it needs to be and confusing" point. Trying out .NET Core from a tarball Go to and download the .tar.gz for your distro to a nice local area. NOTE: You MAY need to apt-get install libunwind8 if you get an error like "Failed to load /home/ubuntu/teste-dotnet-rc2/, error: cannot open shared object file: No such file or directory" but libunwind isn't very controversial. Once you've unziped/tar'd it into a local folder, just be sure to run dotnet from that folder.Desktop $ mkdir dotnetlinuxDesktop $ cd dotnetlinux/dotnetlinux $ lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 16.04.2 LTSRelease: 16.04Codename: xenialdotnetlinux $ curl -o dotnet.tar.gz $ tar -xvf dotnet.tar.gzdotnetlinux $ cd /mnt/c/Users/scott/Desktop/localdotnettest/localdotnettest $ ../dotnetlinux/dotnet new consoleContent generation time: 103.842 msThe template "Console Application" created successfully.localdotnettest $ ../dotnetlinux/dotnet restore Restoring packages for /mnt/c/Users/scott/Desktop/localdotnettest/localdotnettest.csproj...localdotnettest $ ../dotnetlinux/dotnet runHello World! There aren't samples in this tar file (yet) but there are (some weak) samples at you can clone and run them from samples. Note from the ReadMe that is the jumping off point for the other repos. The more interesting "samples" are the templates you have available to you from "dotnet new."localdotnettest $ /mnt/c/Users/scott/Desktop/dotnetlinux/dotnet new*SNIP*Templates Short Name Language Tags----------------------------------------------------------------------Console Application console [C#], F# Common/ConsoleClass library classlib [C#], F# Common/LibraryUnit Test Project mstest [C#], F# Test/MSTestxUnit Test Project xunit [C#], F# Test/xUnitASP.NET Core Empty web [C#] Web/EmptyASP.NET Core Web App mvc [C#], F# Web/MVCASP.NET Core Web API webapi [C#] Web/WebAPISolution File sln SolutionExamples: dotnet new mvc --auth None --framework netcoreapp1.1 dotnet new classlib dotnet new --help From here you can "dotnet new web" or "dotnet new console" using your local dotnet before you decide to commit to installing .NET Core from an apt repo or yum or whatever. Sponsor: Check out Seq: simple centralized logging, on your inf[...]

RetroPie and X-Arcade Tankstick - The perfect Retro Arcade (plus keybindings and config and how-to)

Wed, 07 Jun 2017 08:01:31 GMT

Eight years ago I stumbled on the husk of an old arcade cabinet and along with my buddy John Batdorf, proceeded to reclaim the cabinet, refinish, paint, and turn it into a proper MAME (Multi-Arcade Machine Emulator) As an aside, a bit after helping me this project, John happened to start an amazing business making furniture with reclaimed wood, check him out at Amazing stuff, truly. Last week I build a RetroPie into an X-arcade tankstick. This is my best retro arcade yet because it's got HDMI out and I can take it to friends' houses. That said, I'm going to briefly go over my other systems because they may be more attractive for your needs. If you have no patience, scroll down. A full size MAME Cabinet - The Complete MAME Cabinet How-To I wrote up a complete 7 part series on making your own MAME Arcade Cabinet. It's super fun and will only take a few weekends and perhaps a few hundred bucks. Cabinet and Power Monitor and Mounting Control Panel Sound and Lights Paint and Art Computer Hardware and Software Success and Conclusion When I made my first MAME cabinet I put a small "Shuttle PC" inside. The MAME system is in my office and runs to this day on Windows 7 with a HyperSpin frontend. Software Disclaimer 1: There's all sorts of iffy legal issues around emulating arcade games with boards/ROMs you don't own. This series of posts has nothing to do with that. I do own some original arcade boards, but if you want to emulate arcade games with MAME (Multiple Arcade Machine Emulator), you can search the 'tubes. What I'm doing here is putting a computer in a pretty box. Hardware Disclaimer 2: Many folks that build arcade cabinets have a purist view of how these things should be done. They will prefer original Arcade CRT monitors and more expensive, higher quality parts. I am more of a pragmatist. I also have no idea what I'm doing, so I've also got ignorance on my side. There's been a huge amount of work done in the last few years to reconcile the dozens of emulators and systems and the nightmare of keybindings, menus, and configuration. My first MAME machine was a few hours to install and literally weeks of messing around with the settings of various emulators. I started with the legendary v1 "X-Arcade Tankstick" that had was effectively a PS2 keyboard. I took it apart and built it into my MAME system's control panel. I then needed to tell each individual emulator the key codes for up, down, left, right, a, b, x, y, etc. Each emulator had a different configuration file. Some were INI files, some XML, some freaking magic. It's a lot to ask in 2017 to dedicate a complete PC to a retroarcade - in fact, it's just not necessary. A $35 Raspberry Pi 3 (or even an overclocked Raspberry Pi 2) has enough power to handle all but the most complex emulators. Tiny Raspberry Pi Powered "CupCade" Later I discovered RetroPie and built a tiny "cupcade" with plans from AdaFruit.  It is/was a tiny little thing that with just a basic menuing system but it got me thinking about how powerful the Raspberry Pi is. The AdaFruit site has all the plans and parts you can buy. I had a local makerspace laser-cut the case. Assembly was just a weekend. Hyperkin - An off-the shelf RetroArcade Console We also picked up a Hyperkin Retron console. This is a great legal way to plan retro games because it requires actual cartridges. We buy our games at Retro Game Trader. If you are EVER near Portland you HAVE to stop and check it out. It's insane. There's a old joke about building a retro arcade machines - Is it more fun to play retro arcade games, or is it more fun to build a retro arcade machine with a cool front-end where every keybinding works in every emulator but you never get around to playing games? A RetroPie inside an X-Arcade Tankstick There's a whole series of gotchas that took me a few weeks to work through when taking a Raspberry Pi, RetroPie software, and an X-Ar[...]

.NET and Docker

Tue, 06 Jun 2017 00:05:02 GMT

.NET and .NET Core (and Windows!) have been getting better and better with Docker. I run Docker for Windows as it supports both Linux Containers and Windows Containers. They have both a Stable and Edge channel. The Edge (Beta) channel is regularly updated and, as a rule, gets better and better in the year I've been running it. As a slightly unrelated side note, I'm also running Docker on my Synology NAS with a number of containers, as well as .NET Core (my Nas is an Intel chip), Minecraft Server, Plex Server, and CrashPlan. NOTE: Docker for Windows requires 64bit Windows 10 Pro and Microsoft Hyper-V. Please see What to know before you install for a full list of prerequisites. The .NET Team at Microsoft has been getting their dockerfiles in order and organized. It can seem initially the opposite, with lots of cryptic tags and names, but there's a clear method you can read about here. They publish their Docker images in a few different repositories on Docker Hub. It’s important to segment images so that they are easier to find, both on the Docker Hub website as well as with the docker search command. microsoft/dotnet — .NET Core Runtime and SDK images for Linux and Nano Server. microsoft/aspnetcore — ASP.NET Core images for Linux and Nano Server. microsoft/aspnetcore-build — ASP.NET Core images for Linux and Nano Server, intended for building apps. microsoft/dotnet-framework — .NET Framework 3.5 and 4.6.2 images for Windows Server Core. microsoft/aspnet — .NET Framework 3.5 and 4.6.2 ASP.NET images for Windows Server Core. There's also some samples at: microsoft/dotnet-samples — .NET Core samples. microsoft/dotnet-framework-samples — .NET Framework samples. The samples are super easy to try out - STOP READING AND TRY THIS NOW. ;) I'm always impressed with a nice asynchronous ASCII Progress bar. I'm easy to impress. This is a "hello world" sample with a surprise ASCII art. I won't spoil for you.C:\Users\scott\Desktop> docker run microsoft/dotnet-samplesUnable to find image 'microsoft/dotnet-samples:latest' locallylatest: Pulling from microsoft/dotnet-samples10a267c67f42: Downloading [========> ] 9.19MB/52.58MB7e1a7ec87c21: Downloading [======================> ] 10.8MB/18.59MB923d0cd2ed37: Download complete7c523004cf83: Downloading [=========> ] 6.144MB/33.07MBf3582118a43a: Waitingc27ef6b597a0: Waiting All the images are managed and maintained on GitHub so you can get involved if you're not digging the images or files. One interesting thing to point out is the difference between dev images and production images, as well as images you'd use in CI/CD (Build Server) situations to build other images. Here are some examples from GitHub: Development dotnetapp-dev - This sample is good for development and building since it relies on the .NET Core SDK image. It performs dotnet commands on your behalf, reducing the time it takes to create Docker images (assuming you make changes and then test them in a container, iteratively). Production dotnetapp-prod - This sample is good for production since it relies on the .NET Core Runtime image, not the larger .NET Core SDK image. Most apps only need the runtime, reducing the size of your application image. dotnetapp-selfcontained - This sample is also good for production scenarios since it relies on an operating system image (without .NET Core). Self-contained .NET Core apps include .NET Core as part of the app and not as a centrally installed component in a base image. dotnetapp-current - This sample demonstrates how to configure an application to use the .NET Core 1.1 image. Both the .csproj and the Dockerfile have been updated to depend on .NET Core 1.1. This sample is the same as dotnetapp-prod with the exception of relying on a later .NET Core version. aspnetapp - This samples demonstrates a Dockerized ASP.NET Core Web[...]

Visual Studio and IIS Error: Specified argument was out of the range of valid values. Parameter name: site

Sat, 03 Jun 2017 05:40:21 GMT

I got a very obscure and obtuse error running an ASP.NET application under Visual Studio and IIS Express recently. I'm running a Windows 10 Insiders (Fast Ring) build, so it's likely an issue with that, but since I was able to resolve the issue simply, I figured I'd blog it for google posterity .

I would run the ASP.NET app from within Visual Studio and get this totally useless error. It was happening VERY early in the bootstrapping process and NOT in my application. It pretty clearly is happening somewhere in the depths of IIS Express, perhaps in a configurator in HttpRuntime.

Specified argument was out of the range of valid values.
Parameter name: site

I fixed it by going to Windows Features and installing "IIS Hostable Web Core," part of Internet Information Services. I did this in an attempt to "fix whatever's wrong with IIS Express."


That seems to "repair" IIS Express. I'll update this post if I learn more, but hopefully if you got to this post, this fixed it for you also.

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.