Simple Membership and .net Framework 4.0 asp webforms - c#

I search alot but i did not find any useful answer.
can i use Simple Membership with .net Framework 4.0 in asp webforms ?
because when im trying to install Microsoft.AspNet.WebPages.WebData through Nuget it tells me:
install-package : Could not install package 'Microsoft.AspNet.WebPages.Data 3.1.2'. You are trying to install this
package into a project that targets '.NETFramework,Version=v4.0', but
the
package does not contain any assembly references or content files that are compatible with that framework. For more information, contact
the package author.
If i can use it please someone tell me how i should add this on my exist project.
thank you

From the nuget command line, execute the following:
Install-Package Microsoft.AspNet.WebPages.Data -Version 2.0.20710
The 2.0.20710 package contains the .NET 4.0 referenced WebMatrix.Data.dll.

Related

Could not install Dapper 2.0.4 on .Net 4.6.1

I'm trying to install Dapper 2.0.4 via nuget manager as i want to use the latest Dapper.Contrib features
It didn't proceed due to the following error:
Could not install package 'Dapper 2.0.4'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
If i install the lower version (1.6), the installation went successful but i can't use the latest Contrib features.
How can i resolve this?
Hoping for your kind help. Thank you.
I tried the following and it worked for me.
Check Target Framework by right-clicking on the project and selecting the Application tab. If the target framework is .NET framework 4.6.1
Install-Package Dapper -Version 2.0.4 works fine.
If the target framework is less than 4.6.1 (In my case another project has target framework 4.5.2) try installing previous versions of Dapper for example:Install-Package Dapper -Version 1.50.2
Try this instead
Go to "Tools > NuGet Package Manager > NuGet Manager Settings > Package Sources
Once in Package Sources, set name to "Package Source" and Source to "https://www.nuget.org/api/v2/package/Dapper/" then update to save
Install .Net Framework SDK version 4.7.1 minimum.
Select installed target as a Target Framework for all Projects in your Solution
(in Project properties).
Retarget all packages in all projects executing update-package -reinstall -
ignoreDependencies from the Package Manager Console.
Install Dapper.
That should do it for you.
Install .Net Framework SDK version 4.7.1 minimum.
Select installed target as a Target Framework for all Projects in your Solution (in Project properties).
Retarget all packages in all projects executing update-package -reinstall -ignoreDependencies from the Package Manager Console.
Install Dapper.
UPDATE (from comments):
Dapper needs .NET Standard 2.0. Please retry the whole procedure including re-targeting with .NET Framework 4.7.2 as this is the first fully compliant with. Source: weblog.west-wind.com/posts/2019/Feb/19/

How do I install System.Drawing.Common in a project that uses '.NETFramework,Version=v4.5.2'?

I am trying to write some unit tests in C# in a '.NETFramework,Version=v4.5.2' application but all tests give the next error:
'System.IO.FileNotFoundException : Could not load file or assembly
'System.Drawing.Common, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file
specified.'
When I try to install System.Drawing.Common I get the next error from the NuGet package:
Could not install package 'System.Drawing.Common 4.5.1'. You are trying to install this package into a project that targets
'.NETFramework,Version=v4.5.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more
information, contact the package author.
I cannot change the application version or the framework (.NET Core 2.1) and any other trick I found online did not work (or generated more errors).
Help?
in NuGet put this line :
Install-Package System.Drawing.Common -Version 4.5.2
in .NET CLI put :
dotnet add package System.Drawing.Common --version 4.5.2
in Paket CLI put :
paket add System.Drawing.Common --version 4.5.2
Had the same problem. I have cloned solution https://github.com/barnhill/barcodelib . It has two projects: library project targets .Net Standard 2.0 and refers to System.Drawings.Common. Example project depends on library and has reference to System.Drawings.Common. Example project was not compiling due to same error.
My solution was just to remove reference to System.Drawings.Common in nuget packages and readd it (rclick on Example project > Manage nuget packages > Browse Installed, remove the System.Drawings.Common package, and then add it back), unload project and then reload it again
Helped for me.
I managed to solve it by restarting Visual Studio, changing the framework to 4.6.1 (which I could not do before) and adding the reference.
OP's solution migrated from the question to an answer.
you could try to use one of the libs described in here instead https://devblogs.microsoft.com/dotnet/net-core-image-processing/
you could try to use https://www.nuget.org/packages/CoreCompat.System.Drawing/ as well and maybe try to change your app framework to .net standard 2.0?
This is kind of bizarre but it worked dramatically so I'm going to mention it. I built a small vs 2017 ent console project that was supposed to read an oracle database. When I started to run it I got the System.Drawing.Common error mentioned above. It seemed stupid because I wasn't really doing anything having to do with Drawing at all. In Manage Nuget Packages I deleted the Oracle.ManagedDataAccess driver and added the Oracle.ManagedDataAccess.Core and the System.Drawing.Common error went away and I was able to read my oracle database. So I'm suggesting that with NuGet you may be picking up some things you really don't need and if you have any choice for your NuGet packages, try different ones. This also may be some foible with how my organization managed nuget for Visual Studio 2017 enterprise.

Farsi.Library 2.7.0 Fails to install

I tried to install Farsi.Library 2.7.0 through the NuGet Package Manager Console.
But following error occurs:
Install-Package : Could not install package 'Farsi.Library 2.7.0'. You
are trying to install this package into a project that targets
'.NETFramework,Version=v4.5.2', but the package does not contain any
assembly references or content files that are compatible with that
framework. For more information, contact the package author.
According to his blog entry all versions of this library beyond and including version 2.6 are based on .NET Framework 4.6 - somehow this fixes a few bugs with the persian calendar. This is why the installation fails for you.
Install version 2.5.1.5, the latest version of this library which is based on .NET Framework 2.0, to bypass this.
Or upgrade your project to .NET Framework 4.6 or later.
Install-Package Farsi.Library -Version 2.5.1.5

How to use XPathSelectElement in .Net Core 1.0?

In .Net 4.X, this extension method is under System.Xml.XPath.
However I'd like to know how could I find/use it in .Net Core? I have a class library.
The porting tool doesn't show anything about XPathSelectElement.
Or maybe any replacement in .Net core?
Thanks a lot!
You need to add package System.Xml.XPath.XDocument 4.0.1. This package provides extension methods that add System.Xml.XPath support to the System.Xml.XDocument package.
Run below command in Package Manager Console.
PM> Install-Package System.Xml.XPath.XDocument -Version 4.0.1
You can also install it from NuGet package manager having version NuGet 2.12 or higher.
As suggested by Lex Li, we could use this website to search the package name. In my case it is: System.Xml.XPath.XDocument.

How to add Unity.WebAPI to a .net 4.0 project

I am trying to add Unity.WebAPI to a .net 4.0 project. The latest version, 5.1.0 is for .Net 4.5 so I am trying to use version 0.10.0. I've tried using the Nuget Package Manager Console to install this version using the command:
Install-Package Unity.WebAPI -Version 0.10.0
It installs successfully but the reference in my project is notated with the caution symbol as if there is a problem. When I try to build I get the following error message:
The referenced component 'Unity.WebAPI' could not be found
Unity.WebApi is dependent on Unity which I have successfully installed version 2.1.505.0
One thing I have noticed is that when I go into my packages\Unity2.1.505.0\lib folder, I only have a NET35 and SL30 folder. I would think I would see a NET40 folder but that might be insignificant.
One other note is that I did try installing the later version of Unity.WebAPI version 5.1 which is dependent on Unity 3.0.1304.1 which is not compatible with .net 4.0.
I would welcome any ideas or suggestions on getting Unity.WebAPI installed on my .Net4.0 project. I'd also be glad to provide anymore information one might need to help.
Thanks in advance.

Categories