In my C# solution, there is a web service project in which adding project reference of a class library project does not work, it throws compilation error saying -
The type or namespace name 'xyz' does not exist in the namespace
'abc.pqr' (are you missing an assembly reference?)
abc.pqr.xyz is from the class library being referenced.
while adding dll reference does not throw any compilation error.
I even checked the framework, it is .net framework 4 in both.
One thing more, the project which needs to have a reference was a web service project (Framework 3.5, converted to 4.0).
I added another web service (then converted to 4.0), then added project reference added the same code, compilation goes well.
Issue is with only one project in the solution.
Please help me to figure out the fix.
Related
I'm working on a project that targeting .NET 4.0 Framework. I added a reference to a third party dll file and call its methods in my code and have no error. But when I build the project it gave me The type or namespace error with blue underline on the methods of the dll. Using .NET Reflector I checked dll .NET Version of mscorlib.dll it is 4.0.0.0. My application Target .NET Version is 4.0 then Why I'm getting this error.
What I have done.
Remove all references to the library. Clean the project. Restart the project. again add the references. Not good in English please guide me. Stuck in it last 4 days.
Check if you have privileges to access the dll file. Then try running Visual Studio as administrator. If it does not help try to build the solution as 64x/86x not Any CPU.
I am getting build errors when attempting to publish/build my Visual Studio Team Services (previously VS Online) project to Azure from VS2015. It's the generic Reference could not be found items..
The type or namespace name 'Ninject' could not be found (are you missing a using directive or an assembly reference?)
I was getting Nuget related errors that called Nuget out specifically prior but I changed a setting to get past that although now I can't recall what that actually was. Was just a True/False setting in one of the config files.
Is there maybe something within the nuget.config that should be standardly configured for anything being published to Azure?
Do you have a "NuGet restore" step in the build definition?
I am trying to work an F# tutorial on Pluralsight (see screencaps) where you have to install Xunit and write the tests but it's not working for me. It works fine for someone using Visual Studio as shown in the screencaps below, but I am not using Visual Studio. I'm on a Linux system using Monodevelop and I get this message: Composition error: the type 'Object' is required here and is unavailable. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I think it must be the Assembly.fs file where I'm supposed to add the reference but I am not sure, nor do I know exactly how to add this reference correctly. Furthermore, I am unsure if the problem may be due to Monodevelop not recognizing a valid Linux path and if so, how to fix that. Any help would be greatly appreciated because I'm completely stuck.
Here is the error I'm getting in Monodevelop:
As already mentioned in the comments, there is not enough information in your answer to give you a proper question. The error generally happens when you add reference to a dll that is itself referencing another dll and you do not have a reference to the other dll. So in general, you can fix this by adding the reference (as mentioned in the error message).
The specific assembly that you're getting an issue on is a core library referenced by portable .NET libraries. Try adding a reference as discussed for example here.
Otherwise, you need to give us more information - what type of project are you creating (what .NET version and profile) and what other libraries are you referencing in your project.
I currently have a VS2012 solution with a WP71 project and a WP8 project. Each of these projects reference a Portable Class Library project where I keep the view models. I also have a Unit Test project that references the PCL and contains tests for the view models.
The problem I'm having is when I compile the unit test project I get the following error:
error CS0012: The type 'System.Windows.Input.ICommand' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'
All of the projects, including the unit test project, reference the Portable.MvvmLightLibs NuGet package.
After looking around for this assembly I noticed that there are different versions, one for WP8, one for Silverlight 4, etc. Out of all these versions I'm not sure which to use.
The unit test project is targeting .NET Framework 4.5, so I added the System.Windows assembly for that version which works, but I then get the following error:
error : CA0001 : Could not resolve reference to System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes
Seeing as this is a code analysis error I'm tempted to simply ignore this and carry on, but I was wondering if anyone had any ideas on how to solve this or whether it is safe to ignore it?
So, I figured a way to solve the problem.
To get the test project to compile I had to add the System.Windows.dll assembly from:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71
But, adding it using the Add Reference dialog automatically adds the .NET 4.5 version even if I browsed directly to the folder. To fix this I opened the *.csproj for the test project and replaced the line:
<Reference Include="System.Windows"/>
with
<Reference Include="System.Windows">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71\System.Windows.dll</HintPath>
</Reference>
This ensured that the 2.0.5.0 version was referenced instead of the .NET 4.5 version. The problem with this approach is certain types conflict with other assemblies, namely the System.dll, but seeing as I'm only testing view models from a Portable Class Library, I'm not all that bothered.
Ideally the test project would also be a Portable Class Library, but I've not got round to testing that.
One other issue was I tend to have warnings show up as errors when building in release mode, so this always fails because there will always be a warning complaining about naming clashes with System.dll.
I created a project references in one c# 4.0 project to another c# 4.0 project in the same solution.
They are both EXE projects
when I add the reference intelesense starts picking up all of the classes in the referenced project.
However when I go to compile I get the following error "The type or namespace name '...' could not be found (are you missing a using directive or an assembly reference?)". And then all of the Class names lose their blue color and get underlined in red.
Right click on Project Properties
Check Target Framework
If it is .net Framework 4.0 Client Profile than change it to .net Framework 4.0