Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure class diagrams work #256

Closed
davkean opened this issue Jun 22, 2016 · 50 comments · Fixed by #2817
Closed

Make sure class diagrams work #256

davkean opened this issue Jun 22, 2016 · 50 comments · Fixed by #2817
Labels
Parity-Legacy-Feature Missing features from the legacy project system. Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed.
Milestone

Comments

@davkean
Copy link
Member

davkean commented Jun 22, 2016

Class diagrams didn't work in xproj, we need to figure out if that was based on CPS, or just based on the xproj model. We should test them.

@davkean davkean added Feature Request Parity-Legacy-Feature Missing features from the legacy project system. labels Jun 22, 2016
@srivatsn srivatsn added this to the 1.0 RTM milestone Jul 18, 2016
@srivatsn srivatsn modified the milestones: 1.0 RTM, 1.0 RC Aug 10, 2016
@srivatsn srivatsn modified the milestones: 1.0 RC3, 1.0 RC2 Nov 4, 2016
@333fred 333fred modified the milestones: 1.0 RC2, 1.0 RC3 Nov 28, 2016
@333fred
Copy link
Member

333fred commented Dec 6, 2016

The command for the right-click menu is VSConstants.VSStd2KCmdID.ViewInClassDiagram. Old csproj handled this by using an IViewInClassDiagram instance, which is defined in MS.VS.EnterpriseTools.Shell. This binary isn't always installed, so rather than having the project system handle this command and check so see whether the designer is installed, we should make the designer handle the command itself. Dave and I are thinking this is probably beyond the scope of RC3 though. @srivatsn, opinions?

@davkean
Copy link
Member Author

davkean commented Dec 6, 2016

It's already handling View In Class diagram for Class View, so I think it makes more sense to live in the class diagram code.

@srivatsn
Copy link
Contributor

srivatsn commented Dec 6, 2016

That seems fine - why do you think it's beyond the scope of RC3?

@333fred
Copy link
Member

333fred commented Dec 6, 2016

With the edit csproj changes and migration changes, I'm not sure I'll have time for this as well.

@srivatsn srivatsn assigned RaulPerez1 and unassigned 333fred Dec 6, 2016
@srivatsn
Copy link
Contributor

srivatsn commented Dec 6, 2016

Ah ok. @RaulPerez1 would you be able to look into this?

@RaulPerez1
Copy link
Contributor

@davkean where is the class diagram code? I couldn't find any reference in the project system repo so I'm presuming this is in VS?

@davkean
Copy link
Member Author

davkean commented Dec 16, 2016

Yeah, look at the usages of IViewInClassDiagram on index.

@RaulPerez1
Copy link
Contributor

Even though the core class diagram code handles the command (for class view) it does nothing so I think we're going to need changes on our side one way or another.

@srivatsn I think this is going to be larger than a regular bug fix and will definitely not fit in for RC3.

@srivatsn srivatsn modified the milestones: 1.0 RTM, 1.0 RC3 Dec 28, 2016
@srivatsn srivatsn added this to the 1.1 milestone Jan 27, 2017
@Andrey-Ignatenko
Copy link

@davkean added #2820.

@Univac1107
Copy link

Hello, I need to add a class diagram to a .net core class library project.
I've replaced the Microsoft.CSharp.DesignTime.targets file as stated, and restarted VS.
There are no changes, it does not open a manually added class diagram.

Am I missing some other steps?

I'm using Visual Studio Community 2017.
Thank you very much.

@tannergooding
Copy link
Member

@Univac1107, when you attempt to open the class diagram, do you get an error dialog or does attempting to open it cause nothing to occur?

@Univac1107
Copy link

The class diagram option does not appear on the new item menu.
I manually added a class diagram with this content:

<?xml version="1.0" encoding="utf-8"?> <ClassDiagram />

When double clicking it, I get the dialog:

Class diagrams are not supported for this project type.

I've used the file given on: (https://raw.githubusercontent.com/tannergooding/project-system/1ab632313f0715fced04e2f383416f3ec6695268/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/DesignTimeTargets/Microsoft.CSharp.DesignTime.targets).

Should I reinstall VS?

@tannergooding
Copy link
Member

@Univac1107, is it a NetStandard project (#2820)?

Could you share the solution (or a simplified solution) so that I can check this out?

@Univac1107
Copy link

Here is the link to the sample app i'm using:

https://drive.google.com/file/d/0B5Cy0l7YShV2UC1aam9nT0dWNEE/view?usp=sharing

@Univac1107
Copy link

Univac1107 commented Oct 3, 2017

Hello, any update on this?

@tannergooding
Copy link
Member

@Univac1107, I am able to open the class diagram successfully with the solution you supplied (sorry for the delayed response, this slipped my radar).

@Univac1107
Copy link

Univac1107 commented Oct 3, 2017

So I guess I'm missing something.
Beside of replacing that file, is there something else to do?
May the version of VS Community Edition matter? Should I reinstall it?

@tannergooding
Copy link
Member

AFAIK, it shouldn't. You should just have to replace/modify your local copy of Microsoft.CSharp.DesignTime.targets with the fixes in the PR (your local copy, by default, would be under C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\Managed\Microsoft.CSharp.DesignTime.targets).

@justdmitry
Copy link

@Univac1107, double-check changes to file.

I have VS2017 Community Edition (v15.3.0), changed C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\Managed\Microsoft.CSharp.DesignTime.targets with this diff:
targets-diff

Then I restarted VS, manually create *.cd file with content:

<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
  <Font Name="Segoe UI" Size="9" />
</ClassDiagram>

And this diagram successfully opened in VS and I can add classes to it, save, reopen VS and open diagram again. With error message (once after VS launch), but works. Woo-hoo!

@Pilchie Pilchie modified the milestones: 15.5, 15.6 Oct 17, 2017
@mortb
Copy link

mortb commented Oct 24, 2017

Changing in the file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\Managed\Microsoft.CSharp.DesignTime.targets"
from:

<ProjectCapability Include="CSharp;Managed"/>

to:

<ProjectCapability Include="CSharp;Managed;ClassDesigner"/>

fixed the issue for me

@tgitchel
Copy link

tgitchel commented Nov 2, 2017

This works for me, except I cannot create Collection Association links. I get "This is not a valid type name." message when I try.

@sandord
Copy link

sandord commented Nov 10, 2017

This works for me, except I cannot create Collection Association links. I get "This is not a valid type name." message when I try.

Same here, actually in a .NET Framework 4.7 project that references a netstandard 2.0 class library that has the classes in it which I have on my diagram.

@davkean
Copy link
Member Author

davkean commented Nov 29, 2017

@tgitchel @sandord It's been about 12 years since I've used Class Diagrams, can you tell me how/what are Collection Association links are? My google foo is failing me and can't figure out how to attempt to add them.

@tgitchel
Copy link

tgitchel commented Nov 29, 2017

@davkean, a collection association link will show the relationship from one class property that is a collection (array, list, etc.) of another class. If you right-click on the collection property you will see an option for "Show as Collection Association".

@davkean
Copy link
Member Author

davkean commented Nov 29, 2017

@tgitchel Thanks - I can repro this. It looks like the diagram thinks we're a VB project, filed: #3003.

On top of that, there's two other bugs that we have around this:

#2999
#2998

@odalet
Copy link

odalet commented Jan 10, 2018

@justdmitry

Based on your trick, I managed to have my netstandard 2.0 project work with class diagrams (VS 15.4.4):

I simply added this to the end of my .csproj:

  <ItemGroup>
    <ProjectCapability Include="CSharp;Managed;ClassDesigner" />
  </ItemGroup>

and I can add/edit class diagrams in this project (nio need to restart VS as it is local to the project).

Btw, it works whatever framework I target (tried netstandard2.0 and net45).

[Edited] Well, the result is not perfect as quite a few things do not work (I have (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) in the Custom Attributes property, I cannot expand most of my types...); I suppose all this is due to other bugs. This will do for now.

@weitzhandler
Copy link

Are we ever gonna see official Class Designer support in .NET Core or Standard again?

@tannergooding tannergooding removed their assignment May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Parity-Legacy-Feature Missing features from the legacy project system. Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.