I am working on a simple project, where I have a asp.net core library named "BusinessApiClient" version-1.6 and have a web application project named "MyWebProject". I want to add "BusinessApiClient" in "MyWebProject" as reference. But my problem is its always showing error in reference list.
Project.json :
Don't know why its showing error !!!
Hope will get any help.
Thanks in advance.
You need to create your own nuget packages of your Businessapi client.
More information :
Nuget info
+
Than you can put that nuget package in a local folder and use that as a feed: More info
Goodluck!
Related
I have 2 projects that need to share authentication and I'm using Owin cookies.
The first project is an asp.net webform application <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
when the user logs in I need to store it in the cookie.
User u = User.GetUser(username,password); //this is my object
var identity = new System.Security.Claims.ClaimsIdentity(
new List<System.Security.Claims.Claim>
{
new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.NameIdentifier, u.IdUtente.ToString()),
new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, u.utente)
},
CookieAuthenticationDefaults.AuthenticationType,
System.Security.Claims.ClaimTypes.Email,
System.Security.Claims.ClaimTypes.Role
);
var principal = new System.Security.Claims.ClaimsPrincipal(identity);
var ctx = Request.GetOwinContext(); //HERE I'm GETTING THE ERROR
ctx.Authentication.SignIn(identity);
The code line Request.GetOwinContext(); gives me the following error
'HttpRequest' does not contain a definition for GetOwinContext and no accessible extension method GetOwinContext accepting a first argument of type HttpRequest
I found on the internet that I have to install the NuGet Microsoft.Owin.Host.SystemWeb
If I install this nuget and the problem disappears but when I start my application I'm getting the error:
Cannot load file or assembly 'Mono.Android, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = 84e04ff9cfb79065' or one of its dependencies. Cannot find the specified file.
I can't understand the motivation.
Any help?
I fixed downloading the dll from the web and adding the reference manually. But the error it's still not clear.
This issue can happen on any project that uses NuGet packages. If after updating or installing NuGet packages in your project or solution,
you see an error that is mentioning some missing references or dependencies it means that either something is broken inside
or package is not installed correctly because of many uncertain reasons.
I have also faced similar issues so let me try to list down few solutions which resolved my issues.
Go to package manager console and run following command:-
Update-Package -reinstall`
This will initiate reinstallation of each nuget package within that project which should resolve any missing references.
If you came to know that you're missing a specific reference:
Update-Package -reinstall
Restart visual studio
This will resolve the issue which are related to VS or its caching.
You may need to check the version of the package vs. your project.
Sometimes you may need to clear the nuget cache. Nuget cache location can be found from nuget settings > general > browse.
In few cases I just delete 1 single file from cache and then reinstall the package.
Delete all the references from your .config file.
Since you have solved the issue by adding dll but sometimes adding dll can give you issues in future if you are updating versions of dependent packages.
Please try these and do let me know if you are still having the issue. Thanks
I already added the package of Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer, but I'm still getting this error. Is anyone have an idea on how to resolve this issue?Thank you in advance.
Reference: https://www.meziantou.net/versioning-an-asp-net-core-api.htm#integration-with-ope
You haven't said which versions or runtimes you are targeting. I'm going to assume that your project is .NET Core 3.1 or newer and the language is C#. The ApiVersionDesription class is defined in Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.dll. The following are required to resolve this error message:
Reference the Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer NuGet package
Use the corresponding namespace with using Microsoft.AspNetCore.Mvc.ApiExplorer;
You said you've already done #1 so I presume the only issue is #2. If you did not add the reference using tooling, it's worth double-checking that the NuGet package is properly referenced and the containing assembly was also added as a reference.
You also did not mention what your end goal was. 99% of the scenarios that use the API Explorer extensions for API Versioning want to wire up Swashbuckle or some other Open API/Swagger document generator. I would consider reviewing the official API Versioning Swagger Example for ASP.NET Core and cross-reference it with your configuration. It is a working end-to-end solution and should help reveal the step or steps that you're missing.
I am working on a Xamarin.Forms app with PDF features. I am taking my first shot at using PdfSharp (PdfSharp.Xamarin.Forms forked from PdfSharpCore) but finding it's not entirely developer-friendly. I'm trying to use PDFManager and PDFManager.GeneratePDFFromView and was able to do so successfully in my Android project, but it's not working in UWP. The Git page says to init in the UWP App.xaml.cs like this:
PdfSharp.Xamarin.Forms.UWP.Platform.Init();
But when I try this I get the error "The type or namespace name 'UWP' does not exist in the namespace 'PdfSharp.Xamarin.Forms'". Again, I had no problems initializing in Android, but .UWP is not recognized for UWP. I would open this as an issue on GitHub but the option doesn't seem to be there for this repository.
You need to either find PdfSharp.Xamarin.Forms.UWP.dll from the source website directly or download the sample code from that website and build it. Either way this .dll is the file you are looking for. Once you have a copy of this file, use Project>Reference 'Add Reference' to add this .dll to your UWP project. You should find that PdfSharp.Xamarin.Forms.UWP.Platform.Init() is now accepted.
..But of course there is NO guarantee that PdfSharp.Xamarin.Forms will WORK even if you DO successfully add the library ...
I am trying to learn about the MVC structure of Asp.NET core MVC.
Therefore, I am trying to build a small web app similar to the ecommerce system 'simplcommerce' whose code is open source.
My Solution is split into three parts:
1. Modules
2. Infrastructure
3. WebHost
In the Modules part, I have five different Modules (e.g. Contacts, Core) which have their own Controllers, Models, ViewModels and Views.
Now I am trying to add a new Controller into the Contacts Module.
I have already added two Controllers earlier, which was no problem at all.
But after having changed lots of things (like adding and deleting dependencies, adding Models and Views, etc.) I receive the following error-message when trying to add a new Controller:
"There was an error running the selected code generator:
'The specified runtimeconfig.json [C:...\TestApplication\TestAppplication.Module.Contacts\bin\Debug\netcoreapp2.0\TestApplication.Module.Contacts.runtimeconfig.json] does not exist. "
I have checked the folder from the error message and there is no TestApplication.Module.Contacts.runtimeconfig.json.
But I have also checked the same folder in the original SimplCommerce solution, which I have copied parts from, and there is no such file either.
Where is the file from the error message specified?
And what can I do to solve this problem?
Thank you very much in advance!
This file is automatically generated by Visual Studio when you build the project. Interesting thins is that when I removed this file and added new Controller to my test project, this file appeared although I haven't built the solution. The issue looks like your project cannot be compiled.
Make sure that the project does not have any compile-time errors and try to rebuild it before you add the Controller.
I am using latest version of MySQL connector Net to connect to a MySQL database from an ASP.NET form. I have copied the files MySql.Data.dll, MySql.Data.Entity.dll and MySql.Web.dll in the Bin folder of my ASP.NET application. Also I have imported required libraries using these lines:
Imports MySql.Data
Imports MySql.Data.MySqlClient
The image below shows the code and the error that I am getting:
What is wrong with the code please?
I have found a sample, this might help. Click HERE for example describes using ASP.NET/MySql.Data to connect to a MySQL Database.
No idea where dataset came from, should be database=dbherpes.