I have a solution with a number of projects.
I have changed system.Net.http to use the NuGet version, and most projects, when i select the "System.Net.Http" reference in the references node of solution explorer, it shows the path as "X:\myPath\packages\System.Net.Http.4.3.4\lib etc..."
However, i have a couple of projects when removing reference to System.Net.Http then going to NuGet Package Manager and installing it, when you click reference in the reference node, the path shows as "C:\Program Files etc.... Microsoft.NET.Build.Extensions\net461\"
I have opened the project file, and the "HintPath" is correct, however the path that shows in the reference Properties is incorrect.
When i look at Object Browser, it confirms this project is actually calling the framework version of System.Http.Net (so, even though i have installed NuGet version, and the HintPath is pointing to our packages folder, its still referencing the framework version)
Does anyone know why the path isnt matching and how I can fix this (so my project is using NuGet version instead of framework version to match the other projects in my solution?
Just incase it helps, here are all the references in the problem project:
I have a theory: it's a hack implemented in Visual Studio in order to workaround an issue with the package System.Net.Http.
There are issues with this package and it seems we should not use it anymore. The version of the System.Net.Http library included in the .NET Framework is better starting from 4.7.2 if I understand correctly.
See:
https://github.com/dotnet/corefx/issues/11100
https://github.com/dotnet/corefx/issues/17522#issuecomment-338418610
https://github.com/dotnet/corefx/issues/29622
I'm currently moving projects to .NET Framework 4.8 and I'm removing all System.Net.Http packages.
Related
I create a new project using VS2017, select new Console App (Core) version 2.1; etc. When I use NuGet to install the Entity Framewwork Core, version 2.1.1, it is not installing to the Assemblies directory but instead appears under the NuGet directory. When I try to add a migration using the package manager I get a 'The term 'add-migration' is not recognized' error. I have reviewed the other SO answers to this problem, and searched google, but none of those helped.
I have another project, it's an older one from several months ago, where the Entity Framework Core was installed under the Assemblies directory and for that project everything seems to work.
From the above it appears that where NuGet places the Entity Framework Core dll is the only difference and it is causing the package manager to fail to find it.
The get-module command for the older project shows the Entity Framework Core and the correct version, but get-module for the new project does not.
Any thoughts on why this is happening and how I can fix it?
From this post :
The solution that worked for me after trying a whole raft of other solutions posted, was to right click on my project => select 'Manage Nuget Packages' => select the browse tab, but thick 'Include prerelease' check box, and install the 'Microsoft.EntityFrameworkCore.Tools'. N.b that aspnetcore project in visual studio 2017 do not seem to have the 'project.json' file.
I'm trying to do something with .NET core in VS2017 RC, but I noticed the packages.config is missing, because they default in defining dependency in the project file.
However my configuration look like this:
so apparently it should use the file. Apparently it does not honour that configuration.
Furthermore,
Is there some reason we should prefer the dependency in the project file anyway?
In previous versions of .net the csproj contained an assembly reference to a DLL that was stored inside a package. However that was treated seperately, from the packages.config which declared the packages to restore into the packages directory.
In dotnet core, packages are declared inside of the csproj file, as "PackageReference" The overall idea of a packages.config does not exist in dotnet core, which is why visual studio is not trying to create one for you. If you were using the old project system, you will find a packages.config is created for you.
That setting you set won't be honored by .NET Core projects.
.NET Core always uses the package reference. So say goodbye to package.config.
I been beating my head against the wall trying to get this to work. I have a project I did a while ago that used JWT to authenticate users. When I copied the template code from one project to the other, It claimed to be missing a package or libary. I check nuget and apparently I have installed the latest version of the frameworks I need.
Any suggestions for what i am doing wrong?
Check if the assembly is showing any warnings under Project -> References. I've sometimes found that one has a warning. Most commonly this is because there is a mismatch in the .Net version.
I've had a package add a .net 4.5.2 assembly into a project targeting .net 4.5 which exhibited similar behavior.
I have a webforms projects with entity framework 5 and .NET 4.5. When I'm publishing the the web site it generates 'packages' directory in the compiled code, with some entity framework dll's in it. However the website functions well even If I remove it. It should be mentioned that I don't use code-first.
What is the purpose of this folder?
TIA.
First, make sure you're using EF5, as version 5.0, not the 4.4 that may happen if you first installed the EF5 on .net 4 and updated to .net 4.5 later.
http://thedatafarm.com/data-access/when-entity-framework-5-ef5-is-not-entity-framework-5-ef5/
From EF5 on, entity framework is a separate api(package) that can be installed via Library Package Manager or NuGet from Visual Studio, it is not part of .net framework installation any more.
packages folder is a default one for NuGet package installation.
So, please have a look at the EntityFramework reference that must be present in your project where you actually work with EF, and see the version and the location of assembly you are referencing. If your Copy Local property is set to true, you don't need to include packages folder in your installation package, assembly will be copied to bin folder automatically, otherwise you'll have to.
The short answer to your question is : No, you don't need the packages folder
Long answer : No, you don't need the packages folder in production, its created by nuget when you install a package to hold the dlls for that package.
So if you include EF in your project it will be copied in there and a reference will be added to your project to ~/packages/Entityframework.dll, at compile time a copy of the dll will be put in your bin folder.
During releases to our live environment I routinely remove this folder as its not needed.
I read about Web API having its own TraceWriter implementation with 2012.2, for example here, among other sources.
I am now using VS2013 with .NET 4.5.1 and the EnableSystemDiagnosticsTracing is nowhere to be found. It's meant to be defined in the HttpConfigurationTracingExtensions class which resides in the System.Web.Http.Tracing.dll. However, this assembly is nowhere to be found - not in list of assemblies in the Add Reference dialog, not in GAC.
Where is this assembly supposed to come from? Docs say it's part of .NET Framework 4, which I have installed. Also installed the ASP.NET Web API 2 Tracing 5.0.0 NuGet package. Is there some update? Should I re-install .NET Framework?
I know it's not a big deal to implement ITraceWriter myself but it bothers me not to know what happened with the built-in implementation.
Just install needed NuGet Package
Install-Package Microsoft.AspNet.WebApi.Tracing -Version 5.0.0
It's a little bit strange, but it is the right package
http://www.nuget.org/packages/microsoft.aspnet.webapi.tracing
If you installed the Tracing 5.0.0 NuGet package, it should be correctly included in your project. The moment it is installed, I believe a separate text file should open in VS showing the code you should include in your WebApiConfig.cs file.
I haven't created a Web API 2 project from scratch (only upgraded from pre-5.0 to 5.0 projects), but this is the code that should reside in your WebApiConfig.cs file:
// To disable tracing in your application, please comment out or remove the following line of code
// For more information, refer to: http://www.asp.net/web-api
config.EnableSystemDiagnosticsTracing();
And that should be it, if the package is installed correctly, tracing should now be used in your project.