Andrew
Andrew

Reputation: 809

ASP.NET 5 System.Runtime.Caching

I am converting an existing .Net 4.5 MVC 5 project to a new ASP.NET 5 project. One of my files is referencing the System.Runtime.Caching namespace but on moving this file to the new project this namespace cannot be found.

I have added System.Runtime as a dependency in the new project, but the .Caching bit seems to be missing from this. Has anybody experienced a similar problem?

Upvotes: 4

Views: 1877

Answers (2)

CountZero
CountZero

Reputation: 6379

You need to bring in 'Microsoft.Extensions.Caching.Memory' using the following line in your project JSON.

"dependencies": {
    "Microsoft.Extensions.Caching.Memory": "1.0.0"
  }

Current documentation can be found here.

https://docs.asp.net/en/latest/performance/caching/memory.html

Upvotes: 3

Aung Myo Linn
Aung Myo Linn

Reputation: 2890

To use the System.Runtime.Caching namespace in an ASP.NET application, you must add a reference to the namespace.

To add a reference to the Website

  1. In Solution Explorer, right-click the name of the Web site and then click Add Reference.
  2. Select the .NET tab, select System.Runtime.Caching, and then click OK.

Ref: https://msdn.microsoft.com/en-us/library/ff477235(v=vs.110).aspx#Anchor_2

Upvotes: 1

Related Questions