.Net Core – ScottGeek Technology https://scottgeek.technology Fri, 17 Apr 2020 15:59:26 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 Dotnet Core Templates – The Revisit https://scottgeek.technology/2019/10/08/dotnet-core-templates-the-revisit/ https://scottgeek.technology/2019/10/08/dotnet-core-templates-the-revisit/#respond Tue, 08 Oct 2019 14:26:17 +0000 https://scottgeek.technology/?p=5080 So a while back I penned an article (Dotnet new Magic), but now with the latest VS 2019 and Dotnet Core 3.x release… it’s time to revisit.

In case we forgot – the command is:

dotnet new -i “–The Template Reference Name Here–” 

The list of templates can be found in the old place but also here – Dotnet New Templates

What ones do I add:

dotnet new –install “Microsoft.AspNetCore.SpaTemplates”
dotnet new –install “Microsoft.Azure.WebJobs.ProjectTemplates”
dotnet new –install “Microsoft.Azure.WebJobs.ItemTemplates”
dotnet new –install “NUnit3.DotNetNew.Template”
dotnet new –install “Microsoft.AspNetCore.Blazor.Templates”   **Some of these already exist, but this one adds the webassembly type.
dotnet new –install “Microsoft.Azure.IoT.Edge.Module”
dotnet new –install “Microsoft.Azure.IoT.Edge.Function”
dotnet new –install “RaspberryPi.Template”

 

]]>
https://scottgeek.technology/2019/10/08/dotnet-core-templates-the-revisit/feed/ 0
Port Desk Top UI App https://scottgeek.technology/2019/03/03/port-desk-top-ui-app/ https://scottgeek.technology/2019/03/03/port-desk-top-ui-app/#respond Sun, 03 Mar 2019 20:35:53 +0000 https://scottgeek.technology/?p=1843 Not really ready for prime time , but here’s an article stepping through the how-to and the workaround for the fact that Core has yet to add the visual designer for, ya you guessed the actual Windows Form- that seems to be a rather glaring miss if we are talking about porting and doing traditional windows UI forms development going forward.

In this post, I will describe how to port a desktop application from .NET Framework to .NET Core. I picked a WinForms application as an example. Steps for WPF application are similar and I?ll describe what needs to be done different for WPF as we go.

 

]]>
https://scottgeek.technology/2019/03/03/port-desk-top-ui-app/feed/ 0
App Registration Link https://scottgeek.technology/2019/02/03/app-registration-link/ https://scottgeek.technology/2019/02/03/app-registration-link/#respond Sun, 03 Feb 2019 15:08:03 +0000 https://scottgeek.technology/?p=889 This seems to want to move me off to Azure…

But for now the link still works…

https://apps.dev.microsoft.com

]]>
https://scottgeek.technology/2019/02/03/app-registration-link/feed/ 0
Play with dotnet tool and a BOT https://scottgeek.technology/2019/02/01/play-with-dotnet-tool-and-a-bot/ https://scottgeek.technology/2019/02/01/play-with-dotnet-tool-and-a-bot/#respond Fri, 01 Feb 2019 15:36:33 +0000 https://scottgeek.technology/?p=870 I was poking about with cleaning up my DotNet Core sdks and in my travels a found this thing call dotnet tools… Let the experiment begin… To credit the source of an article on Microsoft go here: dotnet tool 

Do a console project with dotnet:

dotnet new console -o botsay

Then, of course, cd into the botsay directory… and edit the Program.cs (yeap you can do this in VS 2017)

Here’s the main method:

using System.Reflection;

static void Main(string[] args)
{
if (args.Length == 0)
{
var versionString = Assembly.GetEntryAssembly()
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
.InformationalVersion
.ToString();

Console.WriteLine($"botsay v{versionString}");
Console.WriteLine("-------------");
Console.WriteLine("\nUsage:");
Console.WriteLine(" botsay <message>");
return;
}

ShowBot(string.Join(' ', args));
}

The ShowBot method is this:

static void ShowBot(string message)
{
    string bot = $"\n        {message}";
    bot += @"
    __________________
                      \
                       \
                          ....
                          ....'
                           ....
                        ..........
                    .............'..'..
                 ................'..'.....
               .......'..........'..'..'....
              ........'..........'..'..'.....
             .'....'..'..........'..'.......'.
             .'..................'...   ......
             .  ......'.........         .....
             .    _            __        ......
            ..    #            ##        ......
           ....       .                 .......
           ......  .......          ............
            ................  ......................
            ........................'................
           ......................'..'......    .......
        .........................'..'.....       .......
     ........    ..'.............'..'....      ..........
   ..'..'...      ...............'.......      ..........
  ...'......     ...... ..........  ......         .......
 ...........   .......              ........        ......
.......        '...'.'.              '.'.'.'         ....
.......       .....'..               ..'.....
   ..       ..........               ..'........
          ............               ..............
         .............               '..............
        ...........'..              .'.'............
       ...............              .'.'.............
      .............'..               ..'..'...........
      ...............                 .'..............
       .........                        ..............
        .....
";
    Console.WriteLine(bot);
}

It’s a simple core console app that takes a text phrase as input and shows the bot saying it.

Now the fun part… Of course, you should make sure that the code compiles. 
Go back to your command window and do the folllowing:

 

dotnet run
dotnet run -- "Hello from the bot"
dotnet run -- hello from the bot

It’s a Bot!

Now… let’s make a dotnet tool…

Edit your botsay.csproj file. You can do this in VS 2017 or your favorite notepad… 

You need to add these lines:

  <PackAsTool>true</PackAsTool>
<ToolCommandName>botsay</ToolCommandName>
<PackageOutputPath>./nupkg</PackageOutputPath>
 

In the end the csproj file show look like:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>

    <PackAsTool>true</PackAsTool>
    <ToolCommandName>botsay</ToolCommandName>
    <PackageOutputPath>./nupkg</PackageOutputPath>

  </PropertyGroup>

</Project>

Now the tool making part:

dotnet pack

dotnet tool install --global --add-source ./nupkg botsay

You can invoke the tool using the following command: botsay
Tool 'botsay' (version '1.0.0') was successfully installed.

Once you get the message back from the “dotnet tool”… command you now have a dotnet tool…
** You may have to close the command window and open a new one… depending on your OS, etc.

You can type botsay –You’re Message Here…

Now, as you experiment don’t forget to clean up 

dotnet tool uninstall -g botsay

You should read more about dotnet tool… start here: dotnet tool on Mircosoft docs

 

 

]]>
https://scottgeek.technology/2019/02/01/play-with-dotnet-tool-and-a-bot/feed/ 0
Blazor and EF Core to Nowhere land. https://scottgeek.technology/2018/08/03/blazor-and-ef-core-to-nowhere-land/ https://scottgeek.technology/2018/08/03/blazor-and-ef-core-to-nowhere-land/#respond Fri, 03 Aug 2018 12:25:53 +0000 https://scottgeek.technology/?p=684 In the long decent into “Experimental” frameworks- this one being Blazor, I’ve been finding some challenges with getting Blazor to work with the latest EF Core. There’s a few examples of Blazor being used with EF Core (i.e. the CRUD example that’s floating around the inter-Tubes), but nothing that seems to work with the latest Blazor Lang template in the latest VS release.

One can go to a lower EF Core version, well mostly… I’ve yet to get my Blazor Hosted Core test app to compile…. let alone the DB-Context to Scaffold… it just spews errors no matter which direction I go in… Oh Bother….

I have to remember that Blazor is “Experimental” – But it would be nice if would keep up with the forward moving components like EF Core and the latest VS releases. I wonder what all of the Blazor Template releases are doing- seems like each time I run up VS there’s a new Blazor Lang Update. Curious…   

]]>
https://scottgeek.technology/2018/08/03/blazor-and-ef-core-to-nowhere-land/feed/ 0