Error while installing package in ASP.NET core app - asp.net

I am using VS 2017 to create ASP.NET Core Web app. While installing Sendgrid package, I am getting following error.
Package Sendgrid 8.0.5 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Sendgrid 8.0.5 supports: net (.NETFramework,Version=v0.0)
Package Microsoft.AspNet.WebApi.Client 5.2.3 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.AspNet.WebApi.Client 5.2.3 supports:
net45 (.NETFramework,Version=v4.5)
portable-net45+netcore45+wp8+wp81+wpa81 (.NETPortable,Version=v0.0,Profile=wp8+netcore45+net45+wp81+wpa81)
Package SendGrid.CSharp.HTTP.Client 3.0.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package SendGrid.CSharp.HTTP.Client 3.0.0 supports: net (.NETFramework,Version=v0.0)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.`
Any solution for this error?

You might need to use the pre-release version.
https://www.nuget.org/packages/SendGrid.NetCore/

The error gives you this support matrix for SendGrid 8.0.5 and its dependencies.
net net45 portable-net45+netcore45+wp8+wp81+wpa81
SendGrid 1
Microsoft.AspNet.WebApi.Client 1 1
SendGrid.CSharp.HTTP.Client 1
You can see that none of them support the Core Framework (netcoreapp) and instead require the Full Framework (net).
If you require your app to run on the Core Framework, you cannot use SendGrid 8.0.5. Your options include (but are not limited to) using SendGrid.NetCore or using MailKit.
If you do not require your app to run on the Core Framework and are okay supporting only the Full Framework (net), then you can use SendGrid 8.0.5.
For our own apps, we've elected to use MailKit version 1.10.0, because it is more mature than SendGrid.NetCore is and it supports the Core Framework. We use it as follows:
project.json
"dependencies": {
"MailKit": "1.10.0"
},
"frameworks": {
"netcoreapp1.1": {}
}
Send an email using SendGrid with MailKit.
var mimeMessage = new MimeMessage();
mimeMessage.From.Add(new MailboxAddress("Admin", "admin#mailbox.com"));
mimeMessage.To.Add(new MailboxAddress("Jon Doe", "jon#doe.com"));
mimeMessage.Subject = "An Email for You!";
mimeMessage.Body = new TextPart("html")
{
Text = "This is the message.";
};
using (var client = new SmtpClient())
{
client.ServerCertificateValidationCallback = (s, c, h, e) => true;
client.Connect("smtp.sendgrid.net", 587);
await client.AuthenticateAsync("myuser#foobar.com", "ASD43234GDX");
await client.SendAsync(mimeMessage);
client.Disconnect(true);
}

Related

How to specify the dotnet 6 runtime for aws lambda, using terraform?

I can deploy a dotnetcore3.1 runtime using this input in my terraform (executed from GitLab CI pipeline):
variable "runtime" {
type = string
default = "dotnetcore3.1"
}
After it deploys, I can manually change the runtime from .NET Core 3.1 to .NET 6:
But how do I specify .NET 6 in the terraform to begin with?
I have tried:
variable "runtime" {
type = string
default = "dotnet6"
}
But I get the following error in my pipeline:
Error: expected runtime to be one of [nodejs nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x nodejs12.x nodejs14.x java8 java8.al2 java11 python2.7 python3.6 python3.7 python3.8 dotnetcore1.0 dotnetcore2.0 dotnetcore2.1 dotnetcore3.1 nodejs4.3-edge go1.x ruby2.5 ruby2.7 provided provided.al2], got dotnet6
How does one select the .NET 6 runtime in TF?
It would seem that .NET 6 isn't supported via Terraform.
This is not entirely true, the AWS provider supports dotnet6 runtime, you just have to have a version of the provider has support for it.
Currently the latest version of the AWS provider is 4.27.0. The support for dotnet6 was introduced around version 4.4.0. Adjusting the provider to have a version greater than 4.4.0 should be enough to have dotnet6 support.
So you would want to modify your required_providers block to something like this:
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">=4.4.0"
}
}
}
dotnet6 works just fine.
I suspect your TF version and/or AWS provider are out of date. I'm using dotnet6 for a lmabda just fine with the following..
"terraformVersions": {
"terraformMajorVersion": "1",
"providerVersions": {
"aws": "4.14.0",
}

Unable to update Microsoft.Owin.Security.Google from version 2.0.0 to 4.0.0

I am trying to implement external authentication in my Web-api project by following this link https://www.youtube.com/watch?v=WsRyvWvo4EI&t=609s
app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions() {
ClientId = "",
ClientSecret=""
});
The code above could not find GoogleOAuth2AuthenticationOptions class.. searching through the problem it appears that my microsoft.owin.security.google package is not updated. When i try to update it using NuGet, it fails to download the package showing the following error:
NuGet Error while downloading the Microsoft.Owin.Security.Goolge 4.0.0
How do i update the package and make the google authentication work
You need to upgrade your project Target Framework to at least .Net Framework 4.5.1

Select.pdf Avoid displaying 'Demo Version - Select.Pdf SDK'

I successfully installed NuGet package 'Select.pdf". When I run the website, I see "Demo Version - Select.Pdf SDK" displaying at the end, What can I do to avoid this ? It's free tool, available from NuGet.
SelectPdf.HtmlToPdf converter = new SelectPdf.HtmlToPdf();
SelectPdf.PdfDocument doc = converter.ConvertUrl("http://www.cnn.com");
doc.Save(Response, false, "test.pdf");
doc.Close();
You have installed the wrong package (Full Version):
Select.Pdf
The free (Community) version is only the Html Converter:
Select.HtmlToPdf
Keep in mind, that the free version only supports up to 5 pages.

Unable to update database to match the current model. Failing only on self hosting project

The following code:
Database.SetInitializer
(new MigrateDatabaseToLatestVersion<Db, Migrations.Configuration>(true));
using (var C = new Db())
{
Console.WriteLine(C.Usuarios.Count());
}
Works on a console test project but on the other console with self-hosting it fails with the Unable to update database to match the current model... migration error
Obviously the migrations are up to date since the other project runs fine and they both do the same configuration since the database model and the migration configuration are on a separated library
I tracked down the problem to the Newtonsoft.Json library.
The package Microsoft.AspNet.WebApi.Client depends on the version 6.0.4 of this library which seems to have conflicts with Entity Framework.
Just upgrading the Newtonsoft.Json with Install-Package Newtonsoft.Json solves the problem

Meteor: issue using alanning:roles with patch installed (upgrading project from v0.9.3.1 to v1.2.0.1)

I've just installed this patch for the alanning:roles package and I'm now getting these errors:
WARNING: Roles template helpers not registered. Handlebars or UI package not found
lookup.js:186 Uncaught Error: No such function: isInRole
This is the code the produces the first error:
if (Package.ui) {
_.each(Roles._uiHelpers, function (func, name) {
Package.ui.UI.registerHelper(name, func)
})
} else if (Package.handlebars) {
_.each(Roles._uiHelpers, function (func, name) {
Package.handlebars.Handlebars.registerHelper(name, func)
})
} else {
console.log && console.log('WARNING: Roles template helpers not registered. Handlebars or UI package not found')
}
Anyone know what I need do to sort these issues? Looks like this has come up before: link
this is my meteor list output:
accounts-password 1.1.3 Password support for accounts
accounts-ui 1.1.6 Simple templates to add login widgets to an app
alanning:roles 1.2.13+ Authorization package for Meteor
aldeed:autoform 5.5.1 Easily create forms with automatic insert and update, and automatic reactive...
aldeed:collection2 2.5.0 Automatic validation of insert and update operations on the client and server.
aldeed:simple-schema 1.3.3 A simple schema validation object with reactivity. Used by collection2 and a...
blaze-html-templates 1.0.1 Compile HTML templates into reactive UI with Meteor Blaze
cfs:filesystem 0.1.2 Filesystem storage adapter for CollectionFS
cfs:standard-packages 0.5.9 Filesystem for Meteor, collectionFS
ecmascript 0.1.4 Compiler plugin that supports ES2015+ in all .js files
ejson 1.0.7 Extended and Extensible JSON library
es5-shim 4.1.13 Shims and polyfills to improve ECMAScript 5 support
insecure 1.0.4 (For prototyping only) Allow all database writes from the client
iron:router 1.0.9 Routing specifically designed for Meteor
jquery 1.11.4 Manipulate the DOM using CSS selectors
matb33:collection-hooks 0.8.0 Extends Mongo.Collection with before/after hooks for insert/update/remove/fi...
meteor-base 1.0.1 Packages that every Meteor app needs
meteorhacks:npm 1.5.0 Use npm modules with your Meteor App
mobile-experience 1.0.1 Packages for a great mobile user experience
mongo 1.1.1 Adaptor for using MongoDB and Minimongo over DDP
mrt:accounts-admin-ui-bootstrap-3 0.2.7 A roles based account management system using bootstrap 3
mrt:jquery-jcrop 0.0.3 jQuery Jcrop repackaged for Meteor
mrt:loading 0.0.1 Loading overlay + spinner
npm-container 1.2.0+ Contains all your npm dependencies
random 1.0.4 Random number generator and utilities
session 1.1.1 Session variable
spacebars 1.0.7 Handlebars-like template language for Meteor
standard-minifiers 1.0.0 Standard minifiers used with Meteor apps by default.
tracker 1.0.8 Dependency tracker to allow reactive callbacks
twbs:bootstrap 3.3.5 The most popular front-end framework for developing responsive, mobile first...
The package needed to have blaze-html-templates listed as a weak dependency along with handlebars. Meteor 1.2 removed a lot of packages from the core that were installed by default.
The patch has been updated to reflect these changes.
api.use(['blaze-html-templates', 'handlebars'], 'client', {weak: true});
Instead of
api.use(['handlebars'], 'client', {weak: true});

Resources