Everything worked fine until I installed (Package Manager Console) the postal package, then uninstalled and installed an older version.
Now I get an error where it previously was not.
Error:
The type or namespace name 'AllowAnonymous' could not be found (are you missing a using directive or an assembly reference?)
Who knows how to fix this?
Probably you are missing the reference to System.Web.Http assembly in your project?
So you need to:
Add the reference to System.Web.Http;
Add using System.Web.Http; to your controller;
To add Reference you need to do next steps:
In Solution Explorer, right-click the project node and click Add
Reference.
In the Add Reference dialog box, select the tab Assemblies, and enter System.Web.Http into search on the right side.
Select the component System.Web.Http, and then click OK.
Link:
How to: Add or Remove References By Using the Add Reference Dialog Box
Updated answer for 2021 on .Net 5.0, turns out I was missing this line:
using Microsoft.AspNetCore.Authorization;
I had the same problem. After reinstalling a package, MVC 5 was removed and then MVC 3 was added! The following command fixed the problem:
PM> update-package
Related
On Mac Visual Studio - Xamarin Project, I get an error:
the type or namespace 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference)
I have tried to resolve it by using the nuget package manager. Specifically, click 'Packages' folder and click 'Add Packages...' and add Linq. Yet it still does not find Linq when I write 'using System.Linq' yet I can see 'System.linq' in the package folder under the project.
Tried : Refresh, Update, turn off and on
Why can't it find and use the package?
Edit: For similiar error 'HttpStatusCode' where it not found under 'System.Net' yet I have the dll (Version 2.0.5.0) found. I tried to install a new nuget package for it, System.Net.Primitives (Version 3.0.9.0) where 'HttpStatusCode' is stored under this new version. When I reference System.Net.Primitives it does not work.
Example:
'\\ The type or namespace name 'Primitives' does not exist in the namespace 'System.Net'
Using System.Net.Primitives;
Using System.Net;
namespace code {
public class Example
{
\\ the type or namespace 'HttpStatusCode' could not be found
public HttpStatusCode HttpResponse;
}
}`
You need just to add System.Core to your References.
In one of my project I solved it by following way:
Open solution explorer. Right click references, Click on assemblies, select system.xml.linq.
Add the reference assembly to the project. Clean and rebuild.
It should serve the purpose.
Add this .nuget to your Solution. Micosoft.Net.Http.
I am creating MVC project behind I am using C# code. I have
`CloudConfigurationManager`
in using read db value . Its showing red Error . I have searched google I need to add namespace.
using Microsoft.Azure;
I have added that also but again Getting Error Like this
type or namespace 'Azure' does not exist in the namespace 'microsoft' (are you missing an assembly reference?) showing like this how to fix this issue how can I add namespace Azure?
i have Fixed issues select Tools Menu select NuGet package Manger console and select package manger console and install Install-Package Microsoft.WindowsAzure.ConfigurationManager after fixed issues
You need reference to the Microsoft.Azure. Follow below steps to add reference.
In Solution Explorer, right click on project and click add reference.
In the Add Reference dialog box, select the tab indicating the type of component you want to reference.
Select the Microsoft.Azure and then click OK.
EDIT :
Also as per J Steen's comment you can add it using nuget package manager. Use below command in Package Manager Console.
Install-Package Microsoft.WindowsAzure.ConfigurationManager
I added all SignalR component but I still have got some errors about dll recognition.
The type or namespace name 'Hub' could not be found (are you missing a using directive or an assembly reference?)
I added following libraries on NuGet;
Microsoft.ASpNet.SignalR
Microsoft.ASpNet.SignalR.Client
Microsoft.ASpNet.SignalR.Core
Microsoft.ASpNet.SignalR.JS
Microsoft.ASpNet.SignalR.OWin
Microsoft.ASpNet.SignalR.SystemWeb
Microsoft.Owin
Microsoft.Owin.Host.SystemWeb
Microsoft.Owin.Security
I think, I don't need most of them.
namespace GenelProject
{
[HubName("gsChat")]
public class ChatHub : Hub
Why Visual Studio doesn't recognize SignalR hub when I want to use it ?
You only need the Microsoft.AspNet.SignalR.Core package. And make sure you have the namespace Microsoft.AspNet.SignalR imported with a using statement in your file.
please right click on your project and select manage Nuget Packages then in Installed tab find Microsoft.ASPnet.signalR press uninstall. then try installing it again.
I have add new infragistics references version 14.1 to my references(v12.1) by using utility and so when i add references with new version than i got some errors...
"Error 6404 The type or namespace name 'Infragistics' could not be found (are you missing a using directive or an assembly reference? ...etc"
it is still finding references of the old version
After installing Infragistics 2014, you should see a menu item in Visual Studio called INFRAGISTICS. Click on that and click on Check for Updates. It will scan your projects for old references, and upgrade all the namespaces and controls to the latest versions. Click on the Upgrade button next to each project that comes up in the list. This will remove all the errors.
Check references to Infragistics dll(s) in your application's config file.
I'm using C#, EF 4 in asp.net 4 and VS 2010.
I'm trying to load namespace System.Data.Linq with this code using System.Data.Linq
and I receive this error:
Error 2 The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
Any idea what I'm doing wrong.
Right click your solution/project. Click Add Reference and search for System.Data.Linq and add the reference there and it should compile.
Just to confirm that Adding the reference to the project didn't work for me because it was already selected.
However, selecting "Copy Local, True" in the Properties pane for the reference made it start working.
That namespace is LINQ-to-SQL, so you'll also need to add a reference to System.Data.Linq.dll; it won't be added by default just by adding Entity Framework.
Try re-change target framework for your project.
Go to Proporties > Application > Target Framework change to another than used now, and next change it back.
VS Installer
The above answers didn't work for me, my problem was that I needed to add LINQ to SQL tools in Visual Studio.
For VS 2022 and project on .NET 6.0 --- Project \ Referencies \ search \ MindBox.Data.Linq, everywhere "OK", install (based on personnel expirience)
Also, may be, need install -- Referencies \MS.System.Linq.Queryable (or MS.Queryable, not remember)
After all action LinqToSQL will be work in project.