Build .net core webapi in openshift v3 - asp.net-web-api

I am very new to openshift and .net core .I try to build a web api project in .netcore 1.1 in openshift v3 .Any one have experience with it.A step-by-step guidance is very helpful for beginners . I created a ropo https://github.com/kuntal-b/netcoreWebAPI/ .
please help/share your experience .

finally its working
Found a sample app https://github.com/redhat-developer/s2i-dotnetcore/tree/master/1.1/test/asp-net-hello-world
Take project.json from there (https://github.com/redhat-developer/s2i-dotnetcore/blob/master/1.1/test/asp-net-hello-world/project.json)
change version
"version": "1.1.0-*",
and remove (https://github.com/dotnet-architecture/eShopOnWeb/pull/14) because there was an error
Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1
"Microsoft.VisualStudio.Web.CodeGeneration.Design" :"1.0.1" ,
project.json after modify
{
"version": "1.1.0-*",
"dependencies": {
"Microsoft.ApplicationInsights.AspNetCore" :"2.0.0" ,
"Microsoft.AspNetCore" :"1.1.2" ,
"Microsoft.AspNetCore.Mvc" :"1.1.3" ,
"Microsoft.AspNetCore.StaticFiles" :"1.0.3" ,
"Microsoft.EntityFrameworkCore" :"1.1.2" ,
"Microsoft.EntityFrameworkCore.Design" :"1.1.1" ,
"Microsoft.EntityFrameworkCore.Tools" :"1.1.0" ,
"Microsoft.Extensions.Logging.Debug" :"1.1.2" ,
"Microsoft.VisualStudio.Web.BrowserLink" :"1.0.1" ,
"MySql.Data.EntityFrameworkCore" :"7.0.7-m61" ,
"Pomelo.EntityFrameworkCore.MySql" :"1.1.2" ,
},
"buildOptions": {
"emitEntryPoint": true
},
"frameworks": {
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
},
"System.Console": "4.0.0-*"
}
}
},
"publishOptions": {
"include": [
"wwwroot",
"hosting.json",
"testCert.pfx"
]
}
}
and build successful in open shift v3 with .net core 1.1
find sample app bellow link .
http://netcore-kuntal-test.7e14.starter-us-west-2.openshiftapps.com/api/values

Related

WebStatus wont compile: The "jquery#3.4.1" library could not be resolved by the "cdnjs" provider

I have the eShopOnContainers solution here: https://github.com/dotnet-architecture/eShopOnContainers. I have been actively working on a variation of it for the last few years. I attempted to compile it this morning and the WebStatus project causes this error:
libman.json(0,0): Error LIB002: The "jquery#3.4.1" library could not be resolved by the "cdnjs" provider
I have found this: https://github.com/aspnet/LibraryManager/issues/685 and this: https://issuemode.com/issues/cdnjs/cdnjs/94570425 (updated yesterday)
So far I have tried what is suggested in the articles:
dotnet tool install -g Microsoft.Web.LibraryManager.Cli (installs version 2.1.75)
libman cache clean
libman restore
Is there anything else I can try? My Libman.json looks like this:
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"library": "jquery#3.4.1",
"destination": "wwwroot/lib/jquery/"
},
{
"provider": "unpkg",
"library": "bootstrap#4.1.3",
"files": [
"dist/css/bootstrap.css",
"dist/css/bootstrap.css.map",
"dist/css/bootstrap.min.css",
"dist/css/bootstrap.min.css.map",
"dist/js/bootstrap.js",
"dist/js/bootstrap.min.js"
],
"destination": "wwwroot/lib/bootstrap/"
}
]
}
Try this:
-Right click libman.json
Disable Client-Side libraries on build
Build the project

.NET 6 System.Drawing.Common Runtime Switch

According to https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only System.Drawing.Common is no longer supported under on non-windows OS UNLESS a runtime configuration switch is set. I've setup runtimeconfig.template.json and see the switch:
"runtimeOptions": {
"configProperties": {
"System.Drawing.EnableUnixSupport": true
}
}
inside the file .runtimeconfig.json in bin/Debug/net6.0
However when I run the app in a linux box using dotnet exec app.dll I still get PlatformNotSupportedException
The following worked for me.
Adding the following line to the .csproj file in a PropertyGroup section:
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Next create a file named runtimeconfig.template.json in the same directory as your project file containing:
{
"configProperties": {
"System.Drawing.EnableUnixSupport": true
}
}
I used the dotnet publish command, which created a [YourAppNameHere].runtimeconfig.json file in the output directory I supplied to the dotnet publish command.
For my asp.net project, the publish resulted in the following [YourAppNameHere].runtimeconfig.jsonfile:
{
"runtimeOptions": {
"tfm": "net6.0",
"includedFrameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.1"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "6.0.1"
}
],
"configProperties": {
"System.Drawing.EnableUnixSupport": true,
"System.GC.Server": true,
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
This worked, where trying to follow the documentation on the page linked to in the question did not. I think this is because I was adding the "runtimeOptions" section in the runtimeconfig.template.json file, but the dotnet publish command was also adding a section named "runtimeOptions", which seems to have prevented the runtime from seeing the "System.Drawing.EnableUnixSupport" option.
For this reason, I excluded the "runTimeOptions" section in my runtimeconfig.template.json file as the publish resulted in the following file that did not work:
{
"runtimeOptions": {
"tfm": "net6.0",
"includedFrameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.1"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "6.0.1"
}
],
"runtimeOptions": {
"configProperties": {
"System.Drawing.EnableUnixSupport": true
}
},
"configProperties": {
"System.GC.Server": true,
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
Note the nested "runtimeOptions", which I believe was causing it to fail when trying to follow the documentation in the link from the question.
One more way is to use set switch in the code:
AppContext.SetSwitch("System.Drawing.EnableUnixSupport", true);

Invalid Container 'DOMAIN_INSTALLABLE' in manifest

I am getting the following error message when trying to publish an app to G Suite Marketplace from Chrome developer dashboard. I am following this documentation.
Below is my manifest.json file.
{
"name": "Test Publishing",
"version": "1.0",
"manifest_version": 2,
"api_console_project_id": "poj_id",
"container": ["DOMAIN_INSTALLABLE"],
"app": {
"urls": [
"https://example.com/"
],
"launch": {
"web_url": "https://example.com"
}
},
"icons": {
"128": "example_icon_128.png"
}
}
Any idea on how to fix this? Is this now changed?
As you may know, G Suite extensions are being migrated from the Chrome Web Store to the G Suite Marketplace.
Web apps can now be published to the G Suite Marketplace directly from the Cloud Console without having to publish them in the Chrome Web Store. See the note at the top of https://developers.google.com/gsuite/marketplace/listing-gsm.

MVC 6 - Razor Views in Class Library tag "Model" with a does not exist error

Visual Studio (2015) is underlining all my references to "Model" in the Class Library Razor views and giving this error message:
The name "Model" does not exist in the current context
I have seen a lot of questions asking this sort of thing in an earlier version of ASP.Net and MVC but not much for this version.
Since these Razor views are setup as an embedded resource they are compiling fine and running fine. They just give me errors in the editor.
In the project.json file I have a reference to Razor Tools that I thought should fix this:
"dependencies": {
"ApolloWeb.Common": "1.0.0-*",
"Microsoft.AspNet.Mvc": "5.2.3",
"Microsoft.AspNetCore.Mvc.ViewFeatures": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.Extensions.FileProviders.Embedded": "1.0.0",
"NETStandard.Library": "1.6.1-preview1-24530-04"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"net46": {}
},
"buildOptions": {
"embed": [ "_Views/**" ],
"preserveCompilationContext": true
}
I have discovered what my issue was.
I copied all the packages that the MVC template pulled into the Main MVC project and started removing them until I reached the one that reproduced the issue.
I was missing a dependency on this package:
"Microsoft.AspNetCore.Mvc": "1.0.1",

Pebble sdk 2.x unable to load resource

I know pebble 2.x is a bit outdated, but that's the watch that I recently got and am interested in writing a small app on this.
I am unable to load the resource files (images and font) in my pebble app. Below is the error message when I try to run pebble build:
Setting top to : /home/mixi/Documents/pebble-dev/helloworld
Setting out to : /home/mixi/Documents/pebble-dev/helloworld/build
Checking for program gcc,cc : arm-none-eabi-gcc
Checking for program ar : arm-none-eabi-ar
Found Pebble SDK in : /home/mixi/.pebble-sdk/SDKs/current/sdk-core/pebble/aplite
'configure' finished successfully (0.220s)
Waf: Entering directory `/home/mixi/Documents/pebble-dev/helloworld/build'
Error Generating Resources: File: bt-icon.png has specified invalid type: bitmap
Must be one of (raw, png, png-trans, font)
Generating resources failed
My appinfo.json:
{
"uuid": "93c49fe2-0b1e-44b8-8fff-22d9c87adab9",
"shortName": "helloworld",
"longName": "helloworld",
"companyName": "MakeAwesomeHappen",
"versionLabel": "1.0",
"sdkVersion": "2.9",
"targetPlatforms": ["aplite", "basalt", "chalk"],
"watchapp": {
"watchface": true
},
"appKeys": {
"dummy": 0
},
"resources": {
"media": [
{
"type": "bitmap",
"name": "IMAGE_BT_ICON",
"file": "bt-icon.png"
}
]
},
"versionCode": 1
}
My Pebble version:
Pebble Tool v4.0 (active SDK: v2.9)
I also tried creating a test app on pebblecloud with their sample. The sample runs fine without resource, but also fails when I add a new resource to the project. Is there a fix to this?
Apparently, pebble 2.x does not like "bitmap" type. All I had to do was change resource type to "png" in the JSON file:
"media": [
{
"type": "png",
"name": "IMAGE_BT_ICON",
"file": "bt-icon.png"
}
]
OMG =A=..
As for CloudPebble, the drop down for Resource Type doesn't seem to show up and it seems to select Bitmap by default.. Maybe it'll be fixed in the near future idk.

Resources