I added a new class to my Class Library Domain called SongPlayDaily.cs but for some reason it does not display in my reference object browser. See image and correlated numbers:
Observe that the new class exists in my Domain class library
See that I reference this Class Library in my Unearth project.
Upon double clicking the Domain in the references dropdown below Unearth the object browser opens and you can see that SongPlayDaily is not referenced here
This is the console error I experience.
Right clicking on the SongPlayDaily.cs in the Class Library I can confirm that the Build Action: Compile
What other things can I check to see why this new class may not be showing up?
Thanks!
So dumb, I switched my Domain Class Library framework from 4.6.1 to 4.0 back to 4.6.1, rebuilt my solution and it is now referenced....
Related
I have a Xamarin.Forms project and a C# console app project. I want to use one class from the console app in my Xamarin.Forms project.
I added the console app project to the solutions explorer of the Xamarin.Forms project.
Unfortunately, I can't figure out how to use the class from the console app in one of the Xamarin files.
I always get the error message:
The name 'MyClass' does not exist in the current context.
I tried to press alt+enter to show potential fixes but it does not offer me the option of importing/using the class.
I also wrote manual using directives in various forms but it still does not seem to make the class accessible.
The only way I was able to use the class was by adding the class directly to the Xamarin project by adding it with add->existing item. The problem with this is that it imports a copy of the class. Since I'm still working on the class within the other project the added class is fast outdated and I have to manually copy its contents over.
How can I use a class from an external project without making a copy of the file?
Instead of access class from console app(its exe) try creating new reusable library add that class and use in both projects also you can write wrapper class in both projects
Try to add a reference to the second project in your first project. To do this, right-click on your project, select Add Reference then select the project in your solution. Once your main project references the second project, then you can access its public types.
I have a C# class library project in Visual Studio 2017 that I would like to create a class diagram for. The Class Designer is installed. Looking at the context menu for the namespace or any of the classes in the Class View I see the "View Class Diagram" option and also the button for same on the view's menu bar.
However, when I click either the button or the context menu item nothing seems to happen! Flipping back to the Solution Explorer view I can see a ClassDiagram1.cd file has been added to the project. Attempting to open this file though results in an error message:
Class diagrams are not supported by this project type.
Add the class diagram file to a C#, VB or C++ project and try opening it again.
I'd be happy enough to be able to add a diagram myself rather than have it generated if generation is not possible. But I also cannot add a blank class diagram file to the project as that file type does not appear in the file types list in the Add New Item form.
How can I create a class diagram for classes contained in a class library? Or maybe class diagrams are not available for libraries? If the latter is the case is there any info from Microsoft to A) confirm this and B) explain why classes in a program can be diagrammed but not classes in a library. (I did already spend some time googling this matter but did not find anything specific to class libraries)
Since this is the Google #1 link for problems with the Class Designer and surprisingly nobody cared to answer so far (especially the part "Class diagrams are not supported by this project type"), let me chime in:
Close VS and open the file at
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\Managed\Microsoft.CSharp.DesignTime.targets
Search for the line
<ProjectCapability Include="CSharp;Managed"/>
Write "ClassDesigner" as a capability like this:
<ProjectCapability Include="CSharp;Managed;ClassDesigner"/>
Save the file and re-open VS. Your class diagram should work now. You should even be able to add new ones (at least I can in my .NET Standard 2.0 Class Library project in VS2017.5.3).
Actually, the correct answer is to use the Visual Studio Installer as described here in the Microsoft Documentation. And it works!
how-to-add-class-diagrams-to-projects
As far as I can tell, Class Diagrams are not currently supported in .Net Standard and .Net Core projects (they share the same project type) in VS 2017. There are several threads about this on Developer Community, which didn't receive much of a response from Microsoft so far.
You might want to consider creating an issue about this on the dotnet/standard repo.
In Visual Studio 2015, the view option is missing class diagram as represented in the following image.
I have tried Enterprise Architect but that software is unable to detect C# 6 syntax. For example whenever there's public static String readonlyText => "123";, it skips the class.
What's the solution to generate class diagram based on ASP.Net Core code?
In Class View (Ctrl+Shift+C) Right click a namespace or class, and you should see the 'View Class Diagram' option. Useless tho, nothing happens when you click it.
This was probably not working in previous versions, Now in 'Class View' (Ctrl-Shift-C), right click a namespace or class, then click 'View Class Diagram' which creates a new class diagram in the root folder of your project.
Contextual menu in the 'Class View pane'
This works at least in the last edition of VS community edition:
Version in which the feature is working
The new class diagram file, starts empty though.
I have an assignment about OOP in C# that involves me creating a base class (in the form of a class library) and a derived class (as another class library). I realize that for the two to function properly I need to reference the base class' .dll in the derived class. However, I am unable to generate that .dll file for the base class, as I get the error "A project with an Output type of Class Library cannot be started directly". My textbook says the fix for this is to click "Build Solution" in VS 2013, which should make it runnable. I've done so, and yet mien still does not function. Where am I going wrong?
"A project with an Output type of Class Library cannot be started directly"
This means that you are trying to run a project marked as a library, not just build it. Just compile this project without trying to run it, and create another project that is runnable (e.g. console app, win forms app, etc) and reference your current solution from that new project.
Alternatively, change the type of the current project to one that is runnable.
I'm new to XNA and C#. I have this problem:
When I add a new windows game library and I make reference in main project everything seems ok. The problem is when I delete class from this new project. I'm losing the reference for this new library and I don't know why.
Is there solution for this?
have you used the correct using statement,
have you added a reference to the other project correctly
does the class exist in the other project