I've created a Class Library project called Core. The default namespace is XXX.Tasker.Core.
I've created another Console project which references Core. In my Main() I've got some calls to stuff inside the Core but I'm getting an error:
The type or namespace name 'Core' does
not exist in the namespace
'XXXX.Tasker' (are you missing an
assembly reference?)
The only thing I can think of is that the fact my assembly name is Core might be confusing it.. but that really doesn't make much sense.
Any other suggestions?
The problem turned out to be that Core was compiled as .Net Framework 4 and the Console was .Net Framework 4 Client Profile. Apparently you'll just get really weird errors instead of a proper notification when this occurs.. thanks MS! ;)
Related
My Blazor standalone application .Net 5.0 generates a wrong MvcApplicationPartsAssemblyInfo.cs with the following content if I add a project reference to it:
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Wur.GroupTool.Core")]
Giving the following error (note the double 'AttributeAttribute'):
Error CS0234 The type or namespace name 'ApplicationPartAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Mvc.ApplicationParts' (are you missing an assembly reference?) Wur.GroupTool.Blazor C:\Projects\FB-IT\grouptool\sources\Wur.GroupTool\Wur.GroupTool.Blazor\obj\Debug\net5.0\Wur.GroupTool.Blazor.MvcApplicationPartsAssemblyInfo.cs 14 Active
My guess is that the attribute shoule be:
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPart("Wur.GroupTool.Core")]
but since it is generated I have no clue how to handle this problem. Tried changing the code of course but on compilation it is regenerated again and hence the error again.
== EDIT ==
Just started from scratch again using this command:
dotnet --dry-run new blazorwasm -au SingleOrg --framework:net5.0
Changed the library to insert to starget net5.0. Issue stays the same. It could be a bug in the compiler. When 'Attribute' is added it should use that name but instead it adds 'Attribute' to the name resulting to 'AttributeAttribute'.
The answer here is as follows. In the Library I wanted to add some MVC libraries were present. Blazor does not like loading MVC libraries, they don't mix well. The error was misleading. But after removing all code that uses MVC from the library (which should not have been in there in the first place) the reference was accepted just fine.
I need to change the .NET framework of an existing solution from 4.5.1 to 4.0.
Several of the projects in the solution reference OData.
I have updated the references (luckilly NuGet is used here) but it seems like the namespaces are different, or I've made a glaring error somewhere.
I get the following errors when I try a build:
The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
This is a typical reference list:
using System.Web.Http.OData.Builder;
using System.Web.Http.OData.Extensions;
No amount of changing references seems to help, so I'd be grateful for any suggestions!
It looks like this is the reason:
http://docs.telerik.com/data-access/developers-guide/using-web-services/asp.net-web-api/developer-guide-wcfservices-web-api-install-nuget-netframework40
The type or namespace name 'DataServiceKeyAttribute' does not exist in
the namespace 'System.Data.Services.Common' (are you missing an
assembly reference?)
This is the error that I have been getting and its driving me crazy. I am trying to build a web portal and I am following this tutorial.
Now after extensive search I am done and out. My target Framework is .Net Framework4 and there are some assemblies, specially the one from CRM sdk with version 5.0.
Could this be an issue?
This Type is defined in the .NET Framework Assembly Microsoft.Data.Services.Client. Ensure that this assembly is referenced by your project and it should work fine.
I needed to make a console application using nettiers class libraries. I created a new Console Application project, added references to all the libraries from NetTiers and created an app.config file with all the necessary configurations. I get intellisense and no errors and everything when I am doing the coding, but when I go to compile the application, I'm getting an error that PPGEDI.Data doesn't exist.
I only have 1 line in the program.cs Main method:
PPGEDI.Entities.VansEntity van
= DataRepository.VansEntityProvider.GetById(16);
I'm getting the following error:
Error 93
The type or namespace name 'Data'
does not exist in the namespace 'PPGEDI'
(are you missing an assembly reference?)
It's frustrating, because I know I've added the assembly reference:
I'm using Visual Studio 2010, with C# and .NET 4.0. Can anyone give me an idea as to what I need to do to get this to work.
As a note, this works if I use the same statement in a method on an ASPX page in the web application generated by nettiers.
#BrokenGlass, you were absolutely correct. I double checked and it was
set to ".NET Framework Client Profile", I changed it to .NET 4 and
it's working now, can you put that as an answer?
You are using the .NET client profile in your console app which is a "minified" version that doesn’t contain all assemblies.
The problem is that when your app adds a reference to a class library that is targeting the full framework, references to the "full" framework assembly will not resolve. This results in the rather non-forthcoming error message that you see. Switching to the the full .NET 4 as target framework will resolve the issue.
For a more in depth overview of the problem and the .NET 4 Client Profile in general also see "What’s new in .NET Framework 4 Client Profile RTM"
I have a class library project that references another class library. The project fails to build and I get the error 'The type or namespace name 'ReportLibrary' does not exist in the namespace 'MSF' (are you missing an assembly reference?)'
The weird part is that I have other projects referencing the same class library that build fine. The only difference is that they are Windows Application projects. If I change the project type to a Windows Application and add a Program.cs with a [STAThread] and it builds.
So WTF? Anybody know what I'm doing wrong?
Edit (More Details): All projects in the solution are set to the same Target Framework: .NET Framework 3.5
EDIT (Unobfuscated the error message per Hans)
Is the class library (with the error) targeting the Client Profile, and the applications (as well as the reference library) targeting the full framework? If so, this could cause the reference to be invalid, and cause that message.