C# - Xamarin - how to debug a "using ..." error? - c#

I'm using MSVS2015Pro for Xamarin.
I downloaded the project: https://github.com/Clans/FloatingActionButton
But I'm getting an error on:
using Clans.Fab;
It says:
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'Clans' could not be found (are you missing a using directive or an assembly reference?) FAB.Sample D:\Xamarin\FloatingActionButton-Xamarin.Android\FAB.Sample\FloatingActionMenuBehavior.cs 5 Active
as you can see on the following image:
[EDIT]
On the following image you have more details on errors:
My question is:
how can I debug these kind of errors?, I mean, not this one specifically but when there are using errors in general?. How can I know what: Clans.Fab; specifically is needed and from where do I have to download it?
[EDIT]
Then I did:
PM> Install-Package FAB.XamarinAndroid
and the errors disappeared and now I have 255 warnings.
Any idea on how to fix these warnings?
Below you have an screenshot with them:
Any idea on how to get rid of these warnings?

Visual Studio projects you download from github should contains all external references pointing to nuget packages and you restore them on first build (unless project is not configured to restore on build).
Local references are either framework references you should have installed on your machine or other projects inside the solution.
Normally a missed class will be paired with a yellow exlamation symbol on references list indicating that a necessary assembly could not be loaded, that could be a first check to do.
Output window from build could also provide insights about any anomaly related to references.

Related

"The type or namespace could not be found" error while building a project

I am getting this error while trying to build a solution:
Error CS0246
The type or namespace name 'ClassName' could not be found (are you missing a using directive or an assembly reference?)
The error and the red lines disappear when I open the error list and click on it. I can see the missing dll file is recognized by that class and it is also listed in the references.
I searched many questions here but none of them worked for me. Here is a list of things I tried so far that might help to understand the problem.
I've got the project from TFS and have been never able to build so far. I think the project is not correctly checked in.
I choose 'build only' in the Error list section, after that the errors did not disappear.
All project versions are .Net 4.6, none of them is Client Profile like other in questions here.
I tried to clean, to rebuild, deleting references and adding them again, but none of them worked.
I have changed build output to Diagnostic then inspected errors.
I have found this line and changed all projects target version from 4.6 to 4.6.2 and it worked.
Dll could not be resolved because it was built against the
".NETFramework,Version=v4.6.2" framework. This is a higher version
than the currently targeted framework ".NETFramework,Version=v4.6".

Xamarin Studio, Missing Type or Namespace

I started using Xamarin Studio, and the version is 6.0.1 build 9.
I downloaded sample projects to check its behavior.
I downloaded the projects from the official website.
https://github.com/xamarin/urho-samples
When I start building the project, the error happens as follows.
Error CS0234: The type or namespace name iOS' does not exist in the
namespaceUrho'. Are you missing an assembly reference? (CS0234)
(Urho.Samples.iOS)
error image
I guess I need to fix the building setting, but I don't know how to deal with it.
I'd appreciate your advice.
You are probably missing one or more NuGet packages as indicated by the message.
You can restore the package automatically by going to you solution view, find the project that is missing references, right-click the packages node and click the Restore option.
Here you can also Update all packages or add them.
This is one of the first things you want to do when getting a external project of at first checkout. There is also the option of doing this automatically when building.
For this go the the Xamarin Studio menu option, the Preferences and find the NuGet section. Under General you can check an option to do this automatically when building a solution.
Also, you can let it check for updated packages. Then you will see the '(x.x.x available)' suffix like in the first screenshot.

Build errors ONLY occur when publishing

I'm trying to publish my project which has references to other projects in my solution.
Whenever I build the solution regularly it builds just fine without any errors.
However, whenever I attempt to publish the project I get the message "Build failed".
When I check the output log I see the following 3 errors:
C:\Users\MyUsername\Dropbox\Projects\SEO\QualityLinkBuilder\Web\RealestateJobsMigrations\RealestateJobsConfiguration.cs(10,101,10,124):
error CS0234: The type or namespace name 'RealestateJobsDbContext'
does not exist in the namespace 'RealestateScraper' (are you missing
an assembly reference?)
C:\Users\MyUsername\Dropbox\Projects\SEO\QualityLinkBuilder\Web\RealestateJobsMigrations\RealestateJobsConfiguration.cs(18,56,18,79):
error CS0234: The type or namespace name 'RealestateJobsDbContext'
does not exist in the namespace 'RealestateScraper' (are you missing
an assembly reference?)
C:\Users\MyUsername\Dropbox\Projects\SEO\QualityLinkBuilder\Web\ViewModels\JobsVm.cs(364,51,364,69):
error CS0246: The type or namespace name 'ClosedRealestateId' could
not be found (are you missing a using directive or an assembly
reference?)
However, I have referenced the project "RealestateScraper" and the class RealestateJobsDbContext&ClosedRealestateId exists in the "RealestateScraper" project root namespace which HAS been marked as using in the locations where the output marked the errors.
(like I previously stated, the project builds fine too when not publishing).
What could be the issue here?
I have cleaned&rebuilt but that doesn't seem to change anything.
Note: I'm not showing the code with the errors since it seems to serve no purpose as I am referencing the assemblies in the files correctly (using RealestateScraper;)
I was experiencing this as well- build only failed during publish. Turns out I was using the wrong password for the azure publish and for some reason I cannot explain it would show that the build failed and include some build errors. After correcting the password this was resolved.
Apparently in the RealestateScraper project I was referencing another project .dll at a location where it no longer existed. I updated the reference location and it fixed it.
In my case, I could not identify the error itself. I just changed the publish property "pre-compile". I UNchecked it and then I was able to publish my website
I had some compiler if-then statements in a class. These worked okay when I did a local build, but when publishing they were not interpreted and caused build errors. I refactored my code to remove the compiler directives and it now publishes.
Example:
#if SERVICE
using System.Web
#endif
Changed to:
using System.Web
unfortunately I have the same unresolved problem solution -prog a -prog b completes both the prog and the solution but when I go to publish it gives me error c0246 on using of the project b called in the project a
Help
I tried all of these solutions, and they might have contributed, but I was still getting the error.
I was tipped off by a warning. I had to make this file not read-only within the project, then it worked.
\obj\Release\netcoreapp3.0\PubTmp\Out\web.config

The type or namespace name 'Core' does not exist in the namespace

I encounter this kind of error when I debug a project
I already have EntityFramework.dll, System.Core.dll, System.Data.Entity but still Core is not referenced.
Can someone help me?
I'm having error in this Line
using System.Data.Entity.Core.Objects;
This is the error:
The type or namespace name 'Core' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?)
Enrique, I had this problem crop up when I started opening a project on my desktop that I had normally been opening on my VM. Masoud's answer is not helpful... I don't think he read your original post.
What I did to clear this compile error up was to open NuGet package manager and install the update that was available for EntityFramework. I had version 6.1.1 installed in the project and I upgraded to 6.1.3. I should not have had the error to start with, but upgrading the version appeared to jiggle whatever it was loose because I started compiling fine after that.
Sometimes, when you add references from other sources than nuget manager (example: Local source) you need to verify the HintPath of that reference before moving your application in another environment

The type or namespace name 'FileIO' does not exist in the namespace 'Microsoft.VisualBasic'

I am using visual studio 2012 and .Net framework 4.5. I have included 'Microsoft.VisualBasic' in my project reference.
I am getting the following error while executing the project.
Compilation Error Description: An error occurred during the
compilation of a resource required to service this request. Please
review the following specific error details and modify your source
code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'FileIO'
does not exist in the namespace 'Microsoft.VisualBasic' (are you
missing an assembly reference?)
Source Error:
int lineNumber = 0;
int flag = 1;
using (Microsoft.VisualBasic.FileIO.TextFieldParser parser = new Microsoft.VisualBasic.FileIO.TextFieldParser(file))
{
parser.CommentTokens = new string[] { "#" };
I had tried adding the reference again and again but it doesn't seems to be working.
I even tried the answers from following question in Stack Overflow but nothing helped
microsoft.visualbasic.fileio does not exist
Please help me
Similar to Mark Richman, it still did not give me access to the FileIO. What I did, is click on Tools->NuGet PackageManager->Manage NuGet Packages For Solution. Searched for Microsoft.VisualBasic. Clicked Install, and it gave some terms and conditions that I accepted. After Installing this way, I was able to get the FileIO option.
I got this problem solved now
I have copied Microsoft.VisualBasic.dll file to the bin folder of my project and now it seems to be working fine.
(OR)
You can change the Properties of the reference as follows
-> Right click the Microsoft.VisualBasic reference in solution explorer and change Copy Local property value as 'True' .
This will do the trick
I ran into this error while writing unit tests and thought I had added the reference to my project as described above (and in this answer). However, I was adding the reference to my unit test project rather than my main project. Just in case anyone is as foolish as I was: add your reference to the correct project, clean your project/solution, then profit.

Categories

Resources