Subscribe: Rick Strahl's Web Log
http://feeds.feedburner.com/RickStrahl
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
addin  application  create  files  linux  markdown monster  markdown  monster  net core  net  new  visual studio  web  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: Rick Strahl's Web Log

Rick Strahl's Web Log



Life, Surf, Code and everything in between



 



Creating a Markdown Monster Addin: Save Images to Azure Blob Storage

Mon, 17 Apr 2017 16:30:29 GMT

One of the main reasons why I created the Markdown Monster is that I wanted a Markdown and Weblog Publishing solution that is easily extensible with a relatively easy addin model using the same platform Markdown Monster is built with: .NET. There are lots of editors that do Markdown editing, but generally they are just editors with a few fixed editor related features. Markdown is such a versatile format and there are million ways it can be used that it really makes sense to extend base editor features with custom functionality both for base editing and publishing functionality as well as for custom use cases in specialized applications. Perhaps you need a way to post raw Markdown or converted HTML to a custom Web site that doesn't support standard Weblog publishing APIs. Maybe you need to embed external data or service features into your Markdown frequently, or you want to execute some external code to commit data to a repository or generate static content. Or maybe you want to build custom preview support for one of the special Markdown based language extensions to build presentations, graphs or data analysis representations. The sky's the limit really, once you have an easy addin model that gets you to your own code, along with an easy to use interface to interact with Markdown Monster's own API and user interface. Markdown Monster includes a .NET based addin model that makes it easy to extend its built-in feature set. In this post I'll show how to use C# and .NET to create a new Markdown Monster Addin, and demonstrate a real life use case of an Azure Blob Image Uploader that plugs directly into Markdown Monster. You can check out this addin, by installing it from Markdown Monster's Addin Manager or the source code at: Save To Azure Blob Storage Markdown Monster Addin Addin Registry Markdown Monster ships with an Addin Manager that shows all publicly shared addins. Markdown Monster is a relatively new application so there aren't a lot of addins in the registry yet, but hopefully others will end up sharing their addins in the registry. Part of the reason for this post is to encourage other developers to create new addins and share them in the registry for usage by all MM users. Extending Markdown Monster with C#/.NET There are two ways that you can extend Markdown Monster. Markdown Monster is a .NET application so you can use .NET code to extend it. There are two ways to do this: Use the Commander C# Script Addin The Commander C# Scripts Addin is a great way to create small, ‘scripty’, non-visual functionality that extends Markdown Monster. Common things you do include creating inserting and updating text in the Markdown document, executing external applications and creating custom output formats. Lots of power, but it is essentially script code. Create a Markdown Monster Extension For more complex extensibility or extensions that require user interface support a Markdown Monster Addin is a better choice. While Scripts get access to the same object model, full Addins can hook into the application life cycle, can interact with the user interface and even bring up forms and other UI components on their own. In this post I'm going to focus on creating addins and I'll start by describing how to create a new addin and some of the basic features you can perform, then dive in and build a more practical addin that allows you to save Images to Azure Blob storage and embed those images into the current document. I'll briefly describe how to create a new addin from scratch and then show a specific example of creating an addin that allows saving of images to Azure Blob storage and embedding the resulting link into the current document. The resulting Addin I discuss here looks like this: and you can find it on Github here: SaveToAzureBlob-MarkdownMonster-Addin on GitHub Creating a new Markdown Monster Addin The easiest way to create a new Markdown Monster Addin is to use the Markdown Monster Addin Project Visual Studio Template. You can install this template from the Visual Extensions in Visual Studio: Once [...]



Running .NET Core Apps under Windows Subsystem for Linux (Bash for Windows)

Thu, 13 Apr 2017 19:53:07 GMT

The Windows Subsystem for Linux (WSL), also known as Bash on Ubuntu for Windows makes it very easy to get your feet wet with Linux on Windows 10 without having to set up Virtual machines or installing any software to get Linux up and running. Check out Scott Hanselman's excellent post today (as I'm writing this) on some of the developer features of the WSL shell. In fact, it was a few tweets from Scott yesterday that prompted me to play around with WSL and .NET Core today and write this post. What's WSL? WSL is a built in feature of Windows 10 (Anniversary Update and later) that's always available by simply typing Bash into the Start menu. You get a Bash command prompt: From here you have access to a headless Ubuntu (14.04 or 16.04 with Creators Update) instance with a full Linux file system and access to the host network connection and other hardware. WSL is not a VM - if you open Hyper-V manager in Windows there's nothing running. Rather WSL is a custom implementation of the Linux shell that natively maps Linux api and commands to Windows, and executes them using standard Linux command line tools. This sounds like it'd be very buggy but it appears that this is working very well indeed - well enough in fact to execute a dotnet Web application in the subsystem as I'll show in this post. Accessing Windows Files From Linux WSL can access the Windows File System using a special drive mount: /mnt/c/ gets you to the Windows C drive and from there the entire disk is available. All drives are mapped this way. Opening Bash in any Windows Folder: Type Bash In fact you can open a Windows Command or PowerShell prompt anywhere on your local drive, simply type Bash and be in that folder in the Bash Linux shell: The shell loads in the active Windows folder and I can run all commands that are in scope of that folder. Here I'm displaying the Ubuntu version using lsb_release -a. Note that exit puts me right back into Powershell, but if I changed folders in Bash the PS shell will not reflect the change when I get back - ie. the original shell's scope is preserved as you would expect. Access Linux Files from Windows: Look but don't touch! You can also look at the Linux file system from Windows at: C:\Users\\AppData\Local\lxss\rootfs but it's very important that you don't change files on the Linux Partition from Windows. I didn't know this and promptly modified files with an editor from Windows, only to see them show up in the Windows Explorer, but not with actual Linux file listings which means the directory table is actually corrupted for that folder I was working in. Clearly not a good idea. Moral of the story: It's Ok to modify Windows files from WSL It's not Ok to modify Linux files from Windows This is a bummer, but not as big of a deal as you might think - you can happily work with and modify data on your Windows drives and access those from the Bash shell. It's also nice in that you can use your existing Windows project folders for any .NET Core applications - there's no need to copy files around between the two platforms. You can of course still do that - if you rather use Git to completely restore files on the Linux instance and explicitly work of Linux folders. Just keep in mind that you can't easily edit files using a decent editor from Window - you're more or less limited to command line tools available inside of the headless Linux instance. Using dotnet Command Line Tools in WSL So let's see if we can create a .NET application in the Bash shell for Windows. The first step is: Install the .NET SDK for Linux Go to dot.net for Linux/Ubuntu and follow the installation instructions there. To find out the Ubuntu version running, use this command: lsb_release -a and then follow the rest of the install instruction on the SDK installation page. dotnet new in WSL With the SDK installed you can now use the dotnet command line tooling to create new projects, build, publish and so on. To create a new project do this: Start the Bash shell from the Start Menu Navigate and create a folder f[...]



Virus Scanning Madness for Software Distribution

Sun, 02 Apr 2017 19:22:35 GMT

I've been having having lots of problems recently with VirusTotal, which is used by Chocolatey to scan for malware in Chocolatey distribution packages. VirusTotal is a Web based service that aggregates around 60 virus scanners against an installation binary. The problems is that I frequently see random malware hits by various obscure scanners. In this post I describe the problem and the farce that this has become as some of the malware hits are obviously false positives that actually reverse in a rescan.(image)



Updating my AlbumViewer Sample to ASP.NET Core 1.1 and Angular 4

Fri, 31 Mar 2017 08:05:54 GMT

I updated my AlbumViewer sample application recently to the latest versions of ASP.NET Core (1.1) and the new .csproj project as well Angular 4(image)



More on ASP.NET Core Running under IIS

Fri, 17 Mar 2017 05:40:45 GMT

Since my last post about hosting ASP.NET Core on IIS I've gotten quite a few questions and comments in regards to working with this mixed IIS/Kestrel hosting environment. There are quite a few not so obvious arrangement in this set up and some surprising discoveries in terms of performance and segragation of feature usage between IIS and Kestrel.(image)



Dragging and Dropping Images and Files into the Web Browser Control

Fri, 10 Mar 2017 09:23:34 GMT

Dragging content into the Web Browser control and capturing the content dropped can be tricky. The Web Browser Control is based on Internet Explorer and is actually an ActiveX control hosted inside of a container and because of that is difficult to deal with. In this post I describe how you can get around this issue and still capture images and files dropped on the control and handle the drop operations.(image)



Debugging the Web Browser Control with FireBug

Wed, 08 Mar 2017 10:09:31 GMT

If you need to debug JavaScript code or layout issues in a Web Browser control inside of a Windows desktop application, you've probably found that the experience sucks. Although Internet Explorer on which the control is based suppports rich developer tools, those are not available in the Web Browser control. Enter an oldie but goodie: FireBug which is an embeddable Console implementation that provides a lot of the features that you find in modern browser developer tools and with a couple of lines of html you can add this debugger into your application.(image)



Getting JavaScript Properties for Object Maps by Index or Name

Sat, 04 Mar 2017 21:59:11 GMT

Getting value out of maps that are treated like collections is always something I have to remind myself how to do properly. In this post I look at JavaScript object iteration and picking out values from a JavaScript object by property name or index.(image)



Video Rendering Issues for WPF Windows

Tue, 14 Feb 2017 00:57:23 GMT

Recently I ran into a few reports of black screen of death rendering of Markdown Monster when starting up from a very few users of the application. They reported the screen just shows black, while actually being responsive to moving and showing menus etc. Also moving to another screen often fixes the problem. It turns out this is a hardware related issue with WPF with certain video hardware/monitor combinations. In this post I describe the problem and the workaround to get the application to render properly even on compromised hardware.(image)



Empty SoapActions in ASMX Web Services

Sun, 12 Feb 2017 19:12:01 GMT

Recently I had to deal with an ASMX Web Service that was receiving empty SoapActions from the client. ASMX doesn't like that, but luckily there's an easy work to strip out the errant Soap header.(image)



Creating a portable and embedded Chocolatey Package

Sun, 29 Jan 2017 21:05:40 GMT

Chocolatey is an awesome tool to install software. As a publisher you have a lot of choices of how to create packages and in this post I describe the two packages that I use with Markdown Monster, which is a full downloaded installer package and a fully self contained embedded portable package. Here I cover the basics of Chocolatey package creation and some of the steps required to create a portable package from a full installation and some of the challenges you might run into along the way.(image)



Adding Files to Visual Studio Projects

Wed, 25 Jan 2017 19:35:31 GMT

Visual Studio has a boat load of ways to add new files to a project and various extensions and tools provide even more ways to do the same. Even so the experience to add new files to a project in Visual Studio is one of the most tedious tasks. Here's what bugs me and how I try to work around the verbosity of it all.(image)



New CODE Magazine Article: Getting down to Business with ASP.NET Core

Thu, 12 Jan 2017 20:19:27 GMT

The latest issue of CODE magazine features my `Getting down to Business with ASP.NET` Core article as the cover article. The article focuses on building an ASP.NET Core backend for an Angular 2 front application, covering all aspects of separating business and Web app logic, dealing with EF Core data access in related tables, CORS to be able to run across domains and simple authentication in a client centric REST service application. Check it out.(image)



Faking out the .NET Runtime Version

Tue, 10 Jan 2017 07:04:01 GMT

I've been struggling with DPI Scaling issues in WPF in Markdown Monster and .NET 4.6.2 has a few fixes that address the problems I've been working on. However, requiring 4.6.2 is a problem due to lowish adoption rates and skittishness about installing new versions of .NET. In this post I show a little hack that allows me to compile my app to .NET 4.6.2 but don't require user to have that version installed so those that have it can take advantage of the updates.(image)



Back to Basics: String Interpolation in C#

Tue, 27 Dec 2016 08:12:59 GMT

String Interpolation provides string templating for string literals in C#. Rather than using string.Format you can use string interpolation to produce much more readable code that embeds expression values directly into string literals rather than escaping numeric arguments as you do with string.Format(). In this post I look at how string interpolation works, what the compiler does under the covers and some common use cases where it makes life easier.(image)



Downgrading a .NET Applications from 64 bit to 32 bit for the WebBrowser Control

Fri, 23 Dec 2016 09:14:52 GMT

Recently while working on Markdown Monster I ran into some odd crashes and behaviors when interacting with the Web Browser control in this WPF application. It turns out that some of these inconsistent behaviors are apparently caused by running hte application in 64 bit mode. Switching to 32 bit mode has made the application and Web Browser interaction much more responsive and has stopped the nagging unexplainable crashes. In this post I look at 32 and 64 bit applications in .NET and outline some of the issues I ran into and how I fixed the problem by switching to building a 32 bit app.(image)



Visual Studio Debugging and 64 Bit .NET Applications

Mon, 19 Dec 2016 08:26:59 GMT

Recently while debugging a 64 bit application I found out the hard way that Visual Studio by default will use 32 bit debugging even when running what would otherwise be a 64 bit .NET application. There are a number of options that determine the bitness of your application, but the debugger often behaves differently than your standalone application. In this post I describe, why this might be a problem in some situations and how you can get the debugger to run in 64 bit.(image)



WPF Rendering DUCE.Channel Crashes due to Image Loading

Thu, 15 Dec 2016 09:43:47 GMT

I ran into a nasty WPF rendering bug that affected only a few select machines. Rendering problems in WPF can be terribly difificult to debug because there often is no additional information on what failed and the exceptions that occur are not trappable but fall back to application wide error handling. In this post I describe a specific failure caused by a 'bad' image WPF can't deal with and how I tracked it down and fixed it.(image)



Loading .NET Assemblies out of Seperate Folders

Mon, 12 Dec 2016 09:49:25 GMT

In the process of updating the Addin manager in Markdown Monster I ran into a few snags with loading .NET assemblies out of separate folders. Assembly loading out of non base folders in .NET can be problematic and sure enough I ran into a few issues that took a while to find a work around for. In this post I describe some of the issues of folder based assembly loading and a brute force solution to deal with assembly resolution.(image)



.NET Standard 2.0 - Making Sense of .NET Again

Wed, 23 Nov 2016 09:29:40 GMT

It's taken awhile but it seems Microsoft is finally nailing the message for .NET going forward and .NET Standard with its common API specification is a huge part in making sure that the same base library of .NET is available on all .NET platforms. In this post I look at what .NET Standard is, how it works and what some of the surrounding issues and impacts are for the .NET Eco system.(image)



Introducing Markdown Monster - a new Markdown Editor

Fri, 04 Nov 2016 08:14:57 GMT

I'm happy to announce Version 1.0 of Markdown Monster a Markdown Editor and Weblog Publishing tool for Windows. In this post I give a quick tour of Markdown Monster and provide links to all you need to know to check out this great new Markdown editor.(image)



Windows Update Hell

Thu, 03 Nov 2016 19:26:45 GMT

I've been fighting Windows Update Hell for the last month with failed updates wreaking havoc on my machine. Updates fail to install completely and roll back and then continue to retry each day. Attempts to turn off the particular update now fails as well, so I'm stuck in this groundhog day like loop of pain. This is a cry for help, in hopes somebody has additional ideas on what to try.(image)



C# NumberFormat Sections

Thu, 03 Nov 2016 17:27:56 GMT

In all the years I've been using C#, I've completely missed that the NumberFormat features using .ToString() or string expressions support sections for positive, negative and zero values. In this post I describe the feature and how it works.(image)



Excluding the node_modules Folder in Visual Studio WebSite Projects

Sun, 30 Oct 2016 19:42:40 GMT

If you're working on a client side project that includes an NPM folder with a large number of dependencies and you're using a WebSite Project in Visual Studio, you've probably found that this is a terrible combination out of the box. In this post I describe why this is a problem and how you can work around it with a simple hack.(image)



Automating Installation Builds and Chocolatey Packaging

Wed, 26 Oct 2016 06:08:01 GMT

Having a quick and easy way to build a final deployable applicationsin a few minutes has been a huge motivation for me. I can update code and release a new build as soon as a feature is added or a bug is fixed, and my release cycle is much more frequent than it was before. I used to be much more conservative with releases - if something was broken it'd have to wait. But with an easy release mechanism all of that has changed and I can push new releases out much more frequently and I really like the fact that it works this way. In this post I describe my deployment processing for Markdown Monster for creating an installer, publishing it on my Web site and creating and publishing a Chocolatey package.(image)