Visual Studio namespace errors after deleting userControls - visual-studio

Really Visual Studio can be so annoying sometimes...
I did nothing else than deleting 3 UserControls in a folder. Since that time I get a error message I do not get rid of. Whatever I do I can not build successfully my project.
I did not touch the SchoolAdministrationUC.xaml file , but I deleted 3 other UserControls also located in the path: TBM\View\SchoolclassAdministration\
Error message from VS:
Error 1 The type or namespacename "SchoolclassAdministration" is in namespace "TBM.View" not available. (missing assembly reference?) E:\TBM\obj\x86\Debug\View\SchoolclassAdministration\SchoolAdministrationUC.g.cs 33 16 TBM
How do I get rid of error ?

Well, the fact that it shows the obj folder as where the error is, have you tried a clean build? Or a complete rebuild?
Sounds like there is an object out there looking for a non-existent namespace.
Build -> Rebuild Solution

This error comes up when you unwittingly create a new Windows application Project to add the existing code for a class library project in the same project folder. If the original class library project is not compatible with VS or you have any other issue then creating a new class class library is an option.

Related

Deleted files gives CS0246 compiler error in VS2022

I've added 3 default Blazor projects to my solution.
Blazor WebAssembly1
Blazor WebAsssembly2
Blazor Server
The first WebAssembly project is converted to a razor library in order to share code between server and webassembly projects. I also deleted the default pages like FetchData.razor and such.
On compilation I still get compile error on this (the app runs fine though), and I can't seem to resolve them. I've search through the entire solution but can't find any of the files that results in the compile errors.
How to locate the reason for the errors and remove the references? The files are deleted from the project.
Example of compiler error:
CS0246 The type or namepace 'WeatherForecastService' could not be found (are you missing a using directive or an assembly reference?)
The errors in FetchData indicate a problem with the using statements.
Try to check if you have global using, try to remove and declare explicit in the razor page.
Check your CSPROJ and verify the project type, in the RCL the type must be:
<Project Sdk="Microsoft.NET.Sdk.Razor">
In the RCL you haven't a Program/App structure, you have only components and wwwroot elements.
My RCL is composed as follow:
I have also a _Imports.razor with:
#using Microsoft.AspNetCore.Components.Web
...
The issue resolved itself when I restarted Visual Studio.
Sorry for the wild goose chase

Visual C++ error with two projects: name followed by '::' must be a class or namespace name

I'm new to Visual C++. I have two separate projects (let's call the first Converter and the second TreeGridView). I have this line of code in the Converter project:
private: AdvancedDataGridView::TreeGridView^ treeGridView;
which throws this error on 'AdvancedDataGridView':
name followed by '::' must be a class or namespace name
I think I understand the error - Visual C++ can't find a class or namespace called 'AdvancedDataGridView' right?
I have a separate Visual Studio project called TreeGridView which has 3 C# projects included in it. One of the projects has an assembly name of 'ExpandableGridView' and a default namespace of 'AdvancedDataGridView' and an output of type Class Library. Another project has an assembly name of AdvancedDataGridView and a default namespace of AdvancedDataGridView and an output type of Windows Application.
Being new to Visual C++ and the codebase I'm using, I'm not sure how to make the error go away. The TreeGridView project (the one with 3 c# projects) does generate an ExpandableGridView.dll file which I've added a reference to in my Converter project, but the error persists. Intellisense doesn't find AdvancedDataGridView at all. Any ideas?
Additional info: When adding the ExpandableGridView.dll as a reference, I get a yellow warning triangle icon on the reference and 'Full Path' in the properties says
The "Microsoft.VisualStudio.ProjectSystem.References.UnresolvedAssemblyReference" reference
could not be resolved.
Solved. I had two references to the same ExpandableGridView dll file - got rid of both of them, then added the latest dll again - after that the error and warning I mentioned above went away.
You're trying to XOR a type with a variable? Pointers are declared using type*, not type^.
See http://www.cplusplus.com/doc/tutorial/pointers/ for a tutorial on C and C++ pointers.

Dotnetnuke 8 module development error in visual studio 2013

I have successfully installed DNN 8 and all configuration.
i am also referring video to develop module in visual studio.
https://www.youtube.com/watch?v=AKCYRPuoXF4
when i am trying to build the project then
error comes like:
Error 17 The type or namespace name 'DotNetNuke' could not be found
(are you missing a using directive or an assembly
reference?) C:\websites\dnndev.me\DesktopModules\MyDNNModule\MyDNNModuleModuleSettingsBase.cs 13 7 MyDNNModule
Please help to solve that.
thank you in advance.
Working with DNN8, sometimes I get a set of errors with message
The type or namespace name 'DotNetNuke' could not be found (are you
missing a using directive or an assembly reference?)
, probably 10 or 15 of them, and all located on top of one ascx file. (My dotnetnuke.dll is correctly placed in DNN's bin folder). Taking a better look (scroll down!), I can see that - except them - there are some more error messages (maybe just one of them), and that those additional errors are perfectly clear and logical. So I correct my source code in order to avoid those additional messages, and when I do that - those problematic messages also disappear!
In my case it took me a while to find the solution to this problem, since it only got triggered when I made a change to the View.ascx file.
You need the Visual Studio project to target framework to 4.5 instead of 4.5.1.
I got this solution from here.
Make sure to add a Reference to dotnetnuke.dll in the c:\websites\dnndev.me\bin folder
I honestly haven't done anything with DNN 8 CTP yet, I would stick with 7.4.1 until 8 is official released.

References not found

I have multiple projects in my solution and currently I am experiencing a very weird problem:
I have project A - rebuildable with no error.
I have project B referencing project A - also rebuildable with no error.
But when i try to rebuild all, the whole solution with othre projects except A and B it gives me errors:
Error 31 The type or namespace name 'Something' could not be found (are you missing a using directive or an assembly reference?)
And errors are not just in projects A or B, but all over the solution..
but when I comment in project B all the objects created from classes from project A ( and the project A is still referenced in project B) - it all works.
Any idea what may be causing such a strange problem?
thank you
RM click on your Project -> Add Reference...
find your DLL
Updated:
you should change your .Net Framework 4 Client Profile to .Net Framework 4

VisualStudio 2010 Cannot load class diagram "Exception of type 'System.Exception' was thrown."

In a VisualStudio 2010 solution with many projects one of the projects contains some class diagrams. When I try to open them I get the error message Cannot load '<class diagram file>': Exception of type 'System.Exception' was thrown.
Besides googling (I only found solutions for some different problems) I tried the following things:
removed some and all class diagram content: got the same error
added a new class diagram to the project: got the same error
created a new solution & project, and added a new class diagram: it worked!
created a new solution and added the existing project with the class diagrams: it worked!
deleted SUO and SDF file: got the same error
Any idea how I can fix my solution? Creating a new solution would be possible, but tedious, and I would risk to encounter the same problem again. Because the solution is copy right protected and massive I cannot provide it.
Follow these steps:
Go to Project ยป Properties.
Click on Framework And References.
Remove all the references.
In the properties of the project remove the reference under the Framework And References branch
In the project properties, under Framework and References, remove all references that point to non-existent libraries. (marked with a red X)
This can be caused by an invalid reference.
Project > Properties
Common Properties > Frameworks and References
Locate your invalid references; they are marked with a red line in the GUI and may result in a build warning like "The referenced project '......\foo.vcxproj' does not exist."
Class diagrams now load without error
Other answers suggest removing all references, but you probably only need to remove invalid ones.

Resources