Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Extension package should have dependency on Microsoft.VisualStudio.Component.DslTools #293

Open
mmarinchenko opened this issue Jun 19, 2021 · 10 comments
Labels
investigating Looking into this

Comments

@mmarinchenko
Copy link

mmarinchenko commented Jun 19, 2021

It's possible to install EFDesigner extension on Visual Studio without DslTools installed. In this case extension doesn't work (including options page).

It would be convenient to explicitly include corresponding dependency in the package.

@msawczyn
Copy link
Owner

There shouldn't be a dependency on DslTools being installed. I'll investigate.

@msawczyn msawczyn added the investigating Looking into this label Jun 22, 2021
@mmarinchenko
Copy link
Author

Additional info (screenshot and activity log):

  1. image

  2. ActivityLog.xml.txt

@mmarinchenko
Copy link
Author

This only happens in absence of DslTools. When I install DslTools EFDesigner works properly.

@msawczyn
Copy link
Owner

msawczyn commented Jul 8, 2021

The error shown in the ActivityLog occurred when the extension tried to load the MEF assemblies, which support the context menus (among other features). All that's included in Microsoft.VisualStudio.Modeling.Sdk.Shell.15.0.dll, which is part of the VSIX.

Which version of the extension were you trying to install?

@mmarinchenko
Copy link
Author

@msawczyn

I've spent some time investigating this issue further. Here are my findings.

I have v3.0.6.1 installed. But if I understand correctly this issue is really old, see ex. #66, #277, #292. Unfortunately, ActivityLog doesn't contain info about why this happens.

The Microsoft.VisualStudio.Modeling.Sdk.Shell.15.0.dll assembly is part of Microsoft.VisualStudio.Component.VSSDK package. VSSDK itself is not sufficient for EFDesigner to work. There is another package, so-called "Modelling SDK" which is known as Microsoft.VisualStudio.Component.DslTools internally.

DslTools package contains built-in VS extension "Modelling" with Microsoft.VisualStudio.Modeling.Components.15.0.dll assembly which is not part of EFDesigner VSIX. You may try to remove DslTools package through VS Installer (i.e "Modelling SDK") or just move C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Microsoft\Modeling folder to some external location to reproduce the issue.

I hope this helps!

msawczyn added a commit that referenced this issue Jul 9, 2021
   - Fixed a number of issues with importing compiled assemblies
   - Fixed coloring of cascade delete associations when flagged on the model (see #291)
   - Fixed missing '$' in generator template that was generating bad code for table schemas (see #289)
   - Restored auto-instantiation of dependent objects in entity constructors (see #287)
   - Added Microsoft.VisualStudio.Modeling.Components.15.0.dll to DslPackage assembly (see #293)
@msawczyn
Copy link
Owner

msawczyn commented Jul 9, 2021

Ты гений!

Based on the information you supplied, I was able to reproduce the issue and have baked Microsoft.VisualStudio.Modeling.Components.15.0.dll into the package, which appears to resolve it. Can you give it a try at https://github.com/msawczyn/EFDesigner/raw/master/dist/Sawczyn.EFDesigner.EFModel.DslPackage.vsix ?

@mmarinchenko
Copy link
Author

mmarinchenko commented Jul 9, 2021

Ты гений!

Oh, I hardly think so))) But thanks anyway!

https://github.com/msawczyn/EFDesigner/raw/master/dist/Sawczyn.EFDesigner.EFModel.DslPackage.vsix

I installed your VSIX. Version is 3.0.7.0 now. Unfortunately, it still doesn't work.


There are 2 cases.

  1. If I install "Modeling SDK" (DslTools) through VS Installer and then just remove "Modeling" extension folder then it works (previous versions doesn't work in this case).

  2. If I remove "Modeling SDK" (DslTools) through VS Installer then it doesn't work. Perhaps the problem is that the Microsoft.VisualStudio.Modeling.Components.15.0.dll assembly is installed as a MEF component in "Modelling" extension (see its extension.vsixmanifest). My knowledge is not enough to say this for sure.


Maybe you can figure out what's wrong. I've attached an archive with a complete dependency tree of DSL runtime packages from VS Installer:

DslRuntimePackages.zip

@msawczyn
Copy link
Owner

msawczyn commented Jul 9, 2021

Thanks for the testing. I'll dig some more.

@mmarinchenko
Copy link
Author

I have to admit I was wrong initially. Microsoft.VisualStudio.Component.DslTools is not really a package that you can depend on. DSL SDK requires VS Pro edition, so it doesn't work in VS Community.

It turns out the correct package is Microsoft.VisualStudio.PackageGroup.DslRuntime. Or even just Microsoft.VisualStudio.Dsl.Core (if EF Designer doesn't require Microsoft.VisualStudio.Dsl.GraphObject).

If one of this packages will be added as dependency then, I suppose, the following files can be safely removed from EF Designer:

  • Microsoft.VisualStudio.Modeling.Components.15.0.dll
  • Microsoft.VisualStudio.Modeling.Sdk.15.0.dll
  • Microsoft.VisualStudio.Modeling.Sdk.15.0.pdb
  • Microsoft.VisualStudio.Modeling.Sdk.15.0.xml
  • Microsoft.VisualStudio.Modeling.Sdk.Diagrams.15.0.dll
  • Microsoft.VisualStudio.Modeling.Sdk.Diagrams.15.0.xml
  • Microsoft.VisualStudio.Modeling.Sdk.Integration.15.0.dll
  • Microsoft.VisualStudio.Modeling.Sdk.Integration.Shell.15.0.dll
  • Microsoft.VisualStudio.Modeling.Sdk.Integration.Shell.15.0.resources.dll
  • Microsoft.VisualStudio.Modeling.Sdk.Shell.15.0.dll
  • Microsoft.VisualStudio.Modeling.Sdk.Shell.15.0.xml
  • Microsoft.VisualStudio.TextTemplating.Modeling.15.0.dll

@mmarinchenko
Copy link
Author

@msawczyn

I see that you've added Microsoft.VisualStudio.Modeling.Components.15.0.dll as a reference to the DslPackage project trying to solve this issue:

<Reference Include="Microsoft.VisualStudio.Modeling.Components.15.0">
<HintPath>..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\Microsoft\Modeling_\16.0\Microsoft.VisualStudio.Modeling.Components.15.0.dll</HintPath>
</Reference>

Have you tried the following?

1. Remove the mentioned reference from the DslPackage project.

2. Add Microsoft.VisualStudio.Modeling.Components.15.0.dll to the DslPackage project as content similar to these 2 dlls:

<Content Include="Microsoft.Data.ConnectionUI.Dialog.dll">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Microsoft.Data.ConnectionUI.dll">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>

Code to add:

    <Content Include="Microsoft.VisualStudio.Modeling.Components.15.0.dll">
      <IncludeInVSIX>true</IncludeInVSIX>
    </Content>

3. Add Microsoft.VisualStudio.Modeling.Components.15.0.dll to the source.extension.tt template as MefComponent asset:

<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="File" Path="additional.pkgdef" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%|" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="<#= dslProjectName #>" Path="|<#= dslProjectName #>|" />
<Asset Type="Microsoft.VisualStudio.ItemTemplate" d:Source="Project" d:ProjectName="%CurrentProject%" d:TargetPath="|%CurrentProject%;TemplateProjectOutputGroup|" Path="ItemTemplates" d:VsixSubPath="ItemTemplates" />
</Assets>

Code to add:

    <Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="File" Path="Microsoft.VisualStudio.Modeling.Components.15.0.dll" />

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
investigating Looking into this
Projects
None yet
Development

No branches or pull requests

2 participants