Service Stack Vue SPA Application - vue.js

I have created a simple project by using the Service Stack Vue SPA template. I run the app by pressing F5, it works fine.
I am trying to find the way to make it working with app and web tools.
I tried this "app MyApp.dll" and it opens the app but blank and with "web MyApp.dll" it throws null reference exception.
Can you please help me get it working.
Regards,
Jamil

The web dotnet tool is only for .NET Core 2.1 Apps for .NET Core 3.1+ Apps you should use the new x dotnet tool:
$ dotnet tool install --global x
Please note only the app tool supports running in a .NET Core Windows Desktop App, for Console Apps just run the binary with the dotnet tool directly:
$ dotnet MyApp.dll
I followed your description and created a new vue-spa project:
$ x new vue-spa VueSpa
Then after publishing the App:
$ cd VueSpa\VueSpa
$ npm run publish
I can run the published binary with:
$ cd bin\Release\netcoreapp3.1\publish
$ app VueSpa.dll
Which runs it in a Windows Desktop App as expected:

Related

How to run blazor wasm in jetbrains rider

I am using latest MacOS and latest version of Rider.
Seeking advise on how to set up build configuration for a hosted blazor wasm project. Created with this command:
dotnet new blazorwasm --hosted -o blazorhosted
I cd into blazorhosted/server and execute
dotnet run watch
and everything works as expected.
But I don't know how to run it in Rider. As a side not also works in VS Code with debugging on client and server.
This is the error I am getting when running the server configuration in Rider
Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(184, 5): Duplicate base paths '/'
for content root paths '/Users/mha/projects/blazorhosted/Client/bin/Debug/netstandard2.1/wwwroot/'
and '/Users/mha/projects/blazorhosted/Client/wwwroot/'.
('/Users/mha/projects/blazorhosted/Client/obj/Debug/netstandard2.1/blazor/unlinked/blazorhosted.Client.dll',
'/Users/mha/projects/blazorhosted/Client/wwwroot/css/app.css')

Run latest ASP.NET Core version on Google App Engine

I've been working on a .net core 2.0 web app recently and thought of using Google's App Engine on google cloud to host it, but as per the tutorial, google cloud uses .net core 1.0 which doesn't support my project.
Is there any way i can run app made using the newer sdk on the cloud?
Sadly the tutorial is out of date. We have runtime images for .NET Core 1.0, 1.1 and 2.0 now a days. We're going through our documentation and fixing it, but it takes a while.
From the instructions in this updated quickstart you will need to have a minimal app.yaml, something like:
env: flex
runtime: aspnetcore
Then, from the root of your project you run:
dotnet restore
dotnet publish -c Release
Copy the app.yaml to the output of the publish process, typically bin\Release\netcore2.0\publish and then deploy your app with:
gcloud beta app deploy bin\Release\netcore2.0\publish\app.yaml
This command will detect what version of .NET Core you are using and build the appropriate Docker image for you.
Note that the .NET Core support in App Engine Flexible is still in beta, we're working really hard to go to GA soon.
Part 1
Make sure you have the following two files
app.yaml
Dockerfile
with the contents shown below in the root of your project.
app.yaml
env: flex
runtime: custom
Dockerfile
FROM [DOCKER_IMAGE_URL]
COPY . /app
WORKDIR /app
EXPOSE 8080
ENV ASPNETCORE_URLS=http://*:8080
ENTRYPOINT ["dotnet", "[NAME_OF_PROJECT].dll"]
Remember to replace [NAME_OF_PROJECT] with the name of your project and [DOCKER_IMAGE_URL] with one of the URLs from here:
https://hub.docker.com/_/microsoft-dotnet-core-aspnet/
For example: mcr.microsoft.com/dotnet/core/aspnet:3.0 for ASP.NET Core 3.0
Part 2
For the files we created in part 1 to be put into use, they need to be copied to the output/build directory when we run the build command.
This can be done by adding the following
<ItemGroup>
<None Include="app.yaml" CopyToOutputDirectory="PreserveNewest" />
<None Include="Dockerfile" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
to your .csproj file.
Now when we run the build command, they will be copied to ./bin/Release/netcoreapp[VERSION]/publish for the release build and ./bin/Debug/netcoreapp[VERSION] for the debug build.
where [VERSION] is the ASP.NET Core version you are using.
Part 3
From here, deploy using the Google Cloud SDK as usual.
Thanks to:
https://www.youtube.com/watch?v=tZRam__Bx6o
https://cloud.google.com/appengine/docs/flexible/dotnet/runtime
https://docs.docker.com/engine/examples/dotnetcore/
https://cloud.google.com/blog/products/gcp/4-ways-you-can-deploy-an-aspnet-core-app-to-gcp
You can deploy your application as self-contained application, then you can run it w/o a runtime installed.
It's well describe in the ASP.NET Core documentation Self-contained deployment without third-party dependencies
It boils down to adding <RuntimeIdentifier> or <RuntimeIdentifiers> Elements to your csproj file.
<PropertyGroup>
<RuntimeIdentifiers>win10-x64;osx.10.11-x64</RuntimeIdentifiers>
</PropertyGroup>
and doing a dotnet restore, followed by a dotnet build.
Finally you can publish it to one of the platforms you defined above:
dotnet publish -c Release -r win10-x64
dotnet publish -c Release -r osx.10.11-x64
The self-deployment will download all files necessary from nuget, this includes the .NET Core runtime and put it into the output folder.

.Net core - How to create multi-platform executable from a console app

I'm starting to work with .net core 1.1 on a Web API project. The way I'm currently starting my server for the API is by publishing with dotnet publish and then running with dotnet MyProject.dll. Now I have a requirement to start the server from an executable file on Windows and on Linux. I wrote a .net core console app that does just that but the question is how do I wrap in in an executable file for .exe for Windows and what ever it is for Linux...?
I'm just entering the link given in the comment, to mark it as the correct answer.
Self-contained deployment without third-party dependencies

Publish console application via command line using specific publish profile

I try to build and publish my .NET Core applications on the command line using predefined publish profiles.
For a ASP.NET Core application this (taken from here) works:
dotnet build -c Release /p:DeployOnBuild=true /p:PublishProfile=ReleaseFolder
But for a console application (where the publish profile is called FolderProfile, the following does not work:
dotnet build -c Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile
It builds the project but does not publish it.
So how can I publish a console application using a predefined publish profile?
Publish profile support is part of the web-SDK which is used by the web targets. ASP.NET Core applications typically use the Microsoft.NET.Sdk.Web wheres console applications use the Microsoft.NET.Sdk project.
Since console applications therefor don't include the web SDK's publishing support, you can only use the Publish target which generates deployable outputs. It is wrapped by the dotnet cli's dotnet publish command and can alternatively be used as msbuild /t:Publish. This publish command has no support for publish profiles since it is only a filesystem based operation.
You can now add the Microsoft.NET.Sdk.Publish sdk to your project file. That will enable you to use dotnet publish for your project.
<Project Sdk="Microsoft.NET.Sdk;Microsoft.NET.Sdk.Publish">

"dotnet new" command fails on fresh installation of OS X 10.11.6 OS X El Capitan

I have installed the dotnet-core for OS X using the dotnet-osx-x64.1.0.0.pkg from the official download section. - https://www.microsoft.com/net/download
Running "dotnet new" command gives the below output
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
How to create the basic .net-core project?
I have run the below commands on the user directory without success
echo 'export PATH="$PATH:/usr/local/share/dotnet"' >> ~/.bashrc
and
Created a vi .bash_profile and inserted the below command
export
PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/share/dotnet
Still the below command fails
dotnet new
This is the version of the .net-core I have
dotnet --version
gives below output
Microsoft .NET Core Shared Framework Host
Version : 1.0.1
Build : cee57bf6c981237d80aa1631cfe83cb9ba329f12
dotnet-osx-x64.1.0.0.pkg is the package containing just .NET Core, basically the runtime.
In order to develop applications, you need the .NET Core SDK. This is also what the error message you see says:
Did you mean to run dotnet SDK commands? Please install dotnet SDK […]
The download website also explains the difference as follows:
You probably only need to download one of these:
.NET Core SDK = Develop apps with .NET Core and the SDK+CLI (Software Development Kit/Command Line Interface) tools
.NET Core = Run apps with the .NET Core runtime
So, just download the .NET Core SDK package for your platform instead. For mac OS, this currently is dotnet-dev-osx-x64.1.0.0-preview2-003121.pkg.
You can also just follow the instructions on the .NET Core quickstart page which gives you detailed step-by-step instructions on how to get .NET Core running properly.