msawczyn / EFDesigner

Entity Framework visual design surface and code-first code generation for EF6, Core and beyond
MIT License
363 stars 60 forks source link

Trouble compiling EFDesigner (Effort.dll and NMemory.dll) #117

Closed RuiAlias closed 4 years ago

RuiAlias commented 5 years ago

Hi, I managed to compile EFDesigner, but I had some trouble along the way. I had the following issues:

From a fresh git clone of the repository I opened the src\EFDesigner.sln with Visual Studio 2019 and tried building the DslPackage project. And the following errors appeared (excerpt):

image

I opened src\DslPackage\GeneratedCode\GeneratedVSCT.vsct and the deleted the first two blank lines. image

I tried building again and had the following error. image To workaround this I removed from the Effort.dll entry from the src\DslPackage\DslPackage.csproj. I tried building again and had the same error but for the NMemory.dll that I solved the same way.

The lines that I removed: https://github.com/msawczyn/EFDesigner/blob/9fb90da6b823f0693b3b4018e727295108e68ab6/src/DslPackage/DslPackage.csproj#L192-L194

https://github.com/msawczyn/EFDesigner/blob/9fb90da6b823f0693b3b4018e727295108e68ab6/src/DslPackage/DslPackage.csproj#L257-L259

After all this, compilation worked.

Are these issues something we can fix?

msawczyn commented 5 years ago

Those changes will break the VSIX, unfortunately.

Make sure you have the Modeling SDK installed. Likely the latest Visual Studio SDK as well. Those errors looks like you're missing those.

I suppose I should put that in the docs, right? :-P

RuiAlias commented 5 years ago

I have both installed. Perhaps I'm missing something else. Here's the complete list of the workload components I have installed: (Btw I'm using Visual Studio Professional 2019 version 16.3.6)

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.CoreEditor",
    "Microsoft.VisualStudio.Workload.CoreEditor",
    "Microsoft.NetCore.Component.SDK",
    "Microsoft.VisualStudio.Component.NuGet",
    "Microsoft.Net.Component.4.6.1.TargetingPack",
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
    "Microsoft.VisualStudio.Component.FSharp",
    "Microsoft.NetCore.Component.DevelopmentTools",
    "Microsoft.VisualStudio.Component.FSharp.WebTemplates",
    "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
    "Microsoft.VisualStudio.Component.DockerTools",
    "Microsoft.NetCore.Component.Web",
    "Microsoft.Net.Component.4.8.SDK",
    "Microsoft.Net.Component.4.7.2.TargetingPack",
    "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
    "Microsoft.VisualStudio.Component.TypeScript.3.6",
    "Microsoft.VisualStudio.Component.JavaScript.TypeScript",
    "Microsoft.VisualStudio.Component.JavaScript.Diagnostics",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Component.Microsoft.VisualStudio.RazorExtension",
    "Microsoft.VisualStudio.Component.IISExpress",
    "Microsoft.VisualStudio.Component.SQL.ADAL",
    "Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime",
    "Microsoft.VisualStudio.Component.Common.Azure.Tools",
    "Microsoft.VisualStudio.Component.SQL.CLR",
    "Microsoft.VisualStudio.Component.MSODBC.SQL",
    "Microsoft.VisualStudio.Component.MSSQL.CMDLnUtils",
    "Microsoft.VisualStudio.Component.ManagedDesktop.Core",
    "Microsoft.Net.Component.4.5.2.TargetingPack",
    "Microsoft.Net.Component.4.5.TargetingPack",
    "Microsoft.VisualStudio.Component.SQL.SSDT",
    "Microsoft.VisualStudio.Component.SQL.DataSources",
    "Component.Microsoft.Web.LibraryManager",
    "Microsoft.VisualStudio.ComponentGroup.Web",
    "Microsoft.VisualStudio.Component.Web",
    "Microsoft.VisualStudio.Component.IntelliCode",
    "Microsoft.Net.Component.4.TargetingPack",
    "Microsoft.Net.Component.4.5.1.TargetingPack",
    "Microsoft.Net.Component.4.6.TargetingPack",
    "Microsoft.Net.ComponentGroup.TargetingPacks.Common",
    "Microsoft.Net.Core.Component.SDK.2.1",
    "Component.Microsoft.VisualStudio.Web.AzureFunctions",
    "Microsoft.VisualStudio.ComponentGroup.AzureFunctions",
    "Microsoft.VisualStudio.Component.Azure.Compute.Emulator",
    "Microsoft.VisualStudio.Component.Azure.Storage.Emulator",
    "Microsoft.VisualStudio.Component.Azure.ClientLibs",
    "Microsoft.VisualStudio.Component.Azure.AuthoringTools",
    "Microsoft.VisualStudio.Component.CloudExplorer",
    "Microsoft.VisualStudio.ComponentGroup.Web.CloudTools",
    "Microsoft.VisualStudio.Component.DiagnosticTools",
    "Microsoft.VisualStudio.Component.EntityFramework",
    "Microsoft.VisualStudio.Component.AspNet45",
    "Microsoft.VisualStudio.Component.AppInsights.Tools",
    "Microsoft.VisualStudio.Component.WebDeploy",
    "Microsoft.VisualStudio.Component.Debugger.JustInTime",
    "Microsoft.VisualStudio.Workload.NetWeb",
    "Microsoft.VisualStudio.ComponentGroup.Azure.Prerequisites",
    "Microsoft.VisualStudio.Component.Azure.Waverton.BuildTools",
    "Microsoft.VisualStudio.Component.Azure.Waverton",
    "Microsoft.Component.Azure.DataLake.Tools",
    "Microsoft.VisualStudio.Component.Azure.Kubernetes.Tools",
    "Microsoft.VisualStudio.Component.Azure.ResourceManager.Tools",
    "Microsoft.VisualStudio.ComponentGroup.Azure.ResourceManager.Tools",
    "Microsoft.VisualStudio.ComponentGroup.Azure.CloudServices",
    "Microsoft.VisualStudio.Component.Azure.ServiceFabric.Tools",
    "Microsoft.VisualStudio.Workload.Azure",
    "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
    "Microsoft.ComponentGroup.Blend",
    "Microsoft.VisualStudio.Workload.ManagedDesktop",
    "Microsoft.VisualStudio.Component.VSSDK",
    "Microsoft.VisualStudio.ComponentGroup.VisualStudioExtension.Prerequisites",
    "Microsoft.VisualStudio.Component.DslTools",
    "Microsoft.VisualStudio.Workload.VisualStudioExtension",
    "Microsoft.VisualStudio.Workload.NetCoreTools"
  ]
}

Can you export your VS configuration and paste it here so we can compare them?

msawczyn commented 5 years ago

Sure. A quick glance at a file compare and nothing really jumps out at me. There are differences, sure, but nothing that should matter in this context. Maybe I'm missing something.

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.CoreEditor",
    "Microsoft.VisualStudio.Workload.CoreEditor",
    "Microsoft.NetCore.Component.SDK",
    "Microsoft.VisualStudio.Component.NuGet",
    "Microsoft.Net.Component.4.6.1.TargetingPack",
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
    "Microsoft.VisualStudio.Component.FSharp",
    "Microsoft.NetCore.Component.DevelopmentTools",
    "Microsoft.VisualStudio.Component.FSharp.WebTemplates",
    "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
    "Microsoft.VisualStudio.Component.DockerTools",
    "Microsoft.NetCore.Component.Web",
    "Microsoft.Net.Component.4.8.SDK",
    "Microsoft.Net.Component.4.7.2.TargetingPack",
    "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
    "Microsoft.VisualStudio.Component.TypeScript.3.6",
    "Microsoft.VisualStudio.Component.JavaScript.TypeScript",
    "Microsoft.VisualStudio.Component.JavaScript.Diagnostics",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Component.Microsoft.VisualStudio.RazorExtension",
    "Microsoft.VisualStudio.Component.IISExpress",
    "Microsoft.VisualStudio.Component.SQL.ADAL",
    "Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime",
    "Microsoft.VisualStudio.Component.Common.Azure.Tools",
    "Microsoft.VisualStudio.Component.SQL.CLR",
    "Microsoft.VisualStudio.Component.MSODBC.SQL",
    "Microsoft.VisualStudio.Component.MSSQL.CMDLnUtils",
    "Microsoft.VisualStudio.Component.ManagedDesktop.Core",
    "Microsoft.Net.Component.4.5.2.TargetingPack",
    "Microsoft.Net.Component.4.5.TargetingPack",
    "Microsoft.VisualStudio.Component.SQL.SSDT",
    "Microsoft.VisualStudio.Component.SQL.DataSources",
    "Component.Microsoft.Web.LibraryManager",
    "Microsoft.VisualStudio.ComponentGroup.Web",
    "Microsoft.VisualStudio.Component.Web",
    "Microsoft.VisualStudio.Component.IntelliCode",
    "Microsoft.Net.Component.4.TargetingPack",
    "Microsoft.Net.Component.4.5.1.TargetingPack",
    "Microsoft.Net.Component.4.6.TargetingPack",
    "Microsoft.Net.ComponentGroup.TargetingPacks.Common",
    "Microsoft.Net.Core.Component.SDK.2.1",
    "Component.Microsoft.VisualStudio.Web.AzureFunctions",
    "Microsoft.VisualStudio.ComponentGroup.AzureFunctions",
    "Microsoft.VisualStudio.Component.Azure.Compute.Emulator",
    "Microsoft.VisualStudio.Component.Azure.Storage.Emulator",
    "Microsoft.VisualStudio.Component.Azure.ClientLibs",
    "Microsoft.VisualStudio.Component.Azure.AuthoringTools",
    "Microsoft.VisualStudio.Component.CloudExplorer",
    "Microsoft.VisualStudio.Component.Debugger.TimeTravel",
    "Microsoft.VisualStudio.Component.Debugger.Snapshot",
    "Microsoft.VisualStudio.ComponentGroup.Web.CloudTools",
    "Microsoft.VisualStudio.Component.IntelliTrace.FrontEnd",
    "Microsoft.VisualStudio.Component.DiagnosticTools",
    "Microsoft.VisualStudio.Component.EntityFramework",
    "Microsoft.VisualStudio.Component.LiveUnitTesting",
    "Microsoft.VisualStudio.Component.AspNet45",
    "Microsoft.VisualStudio.Component.AppInsights.Tools",
    "Microsoft.VisualStudio.Component.WebDeploy",
    "Microsoft.VisualStudio.Component.Debugger.JustInTime",
    "Microsoft.VisualStudio.ComponentGroup.IISDevelopment",
    "Microsoft.Net.ComponentGroup.4.6.1.DeveloperTools",
    "Microsoft.Net.Component.4.6.2.TargetingPack",
    "Microsoft.Net.ComponentGroup.4.6.2.DeveloperTools",
    "Microsoft.Net.Component.4.7.TargetingPack",
    "Microsoft.Net.ComponentGroup.4.7.DeveloperTools",
    "Microsoft.Net.Component.4.7.1.TargetingPack",
    "Microsoft.Net.ComponentGroup.4.7.1.DeveloperTools",
    "Microsoft.Net.Component.4.8.TargetingPack",
    "Microsoft.Net.ComponentGroup.4.8.DeveloperTools",
    "Microsoft.VisualStudio.Component.ClassDesigner",
    "Microsoft.VisualStudio.Component.CodeClone",
    "Microsoft.VisualStudio.Component.GraphDocument",
    "Microsoft.VisualStudio.Component.CodeMap",
    "Microsoft.VisualStudio.Component.DependencyValidation.Enterprise",
    "Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Managed",
    "Microsoft.VisualStudio.Component.TestTools.WebLoadTest",
    "Microsoft.VisualStudio.ComponentGroup.AdditionalWebProjectTemplates",
    "Microsoft.VisualStudio.Workload.NetWeb",
    "Microsoft.VisualStudio.ComponentGroup.Azure.Prerequisites",
    "Microsoft.VisualStudio.Component.Azure.Waverton.BuildTools",
    "Microsoft.VisualStudio.Component.Azure.Waverton",
    "Microsoft.Component.Azure.DataLake.Tools",
    "Microsoft.VisualStudio.Component.Azure.Kubernetes.Tools",
    "Microsoft.VisualStudio.Component.Azure.ResourceManager.Tools",
    "Microsoft.VisualStudio.ComponentGroup.Azure.ResourceManager.Tools",
    "Microsoft.VisualStudio.ComponentGroup.Azure.CloudServices",
    "Microsoft.VisualStudio.Component.Azure.ServiceFabric.Tools",
    "Microsoft.VisualStudio.Component.Azure.Storage.AzCopy",
    "Microsoft.VisualStudio.Workload.Azure",
    "Microsoft.VisualStudio.Component.Windows10SDK.18362",
    "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
    "Microsoft.ComponentGroup.Blend",
    "Microsoft.VisualStudio.Component.PortableLibrary",
    "Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
    "Microsoft.VisualStudio.Workload.ManagedDesktop",
    "Component.OpenJDK",
    "Microsoft.VisualStudio.Component.MonoDebugger",
    "Microsoft.VisualStudio.Component.Merq",
    "Component.Xamarin.RemotedSimulator",
    "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.TemplateEngine",
    "Component.Xamarin",
    "Component.Android.SDK28",
    "Microsoft.VisualStudio.Workload.NetCrossPlat",
    "Microsoft.VisualStudio.Component.NuGet.BuildTools",
    "Microsoft.VisualStudio.Workload.Data",
    "Microsoft.VisualStudio.Component.VSSDK",
    "Microsoft.VisualStudio.ComponentGroup.VisualStudioExtension.Prerequisites",
    "Microsoft.VisualStudio.Component.DslTools",
    "Microsoft.Component.CodeAnalysis.SDK",
    "Microsoft.VisualStudio.Workload.VisualStudioExtension",
    "Microsoft.VisualStudio.Workload.NetCoreTools",
    "Microsoft.Component.HelpViewer",
    "Microsoft.VisualStudio.Component.AzureDevOps.OfficeIntegration",
    "Microsoft.VisualStudio.Component.LinqToSql",
    "Microsoft.VisualStudio.Component.TestTools.CodedUITest",
    "Component.Xamarin.Inspector",
    "Component.Xamarin.Profiler",
    "Component.Xamarin.Workbooks",
    "Microsoft.Net.Core.Component.SDK.2.2",
    "Microsoft.Component.ClickOnce",
    "Microsoft.VisualStudio.Component.VisualStudioData"
  ]
}
RuiAlias commented 5 years ago

Hi, thanks for the configuration. I've been investigating this issue and I don't think it's a problem of missing Visual Studio workload components.

Looking at the src\DslPackage\DslPackage.csproj there are a bunch of <Content Include="Parsers\{dll-name}.dll"> and it seems possible to trace the origin of each dll except for these two ("Effort.dll" and "NMemory.dll").

I am also not sure that removing these two entries will break the VSIX. Searching through all the repository there are no other references to either "Effort" or "NMemory". Are you sure these two dll are required? (The commit that introduced them)

msawczyn commented 5 years ago

By heaven, you're spot on there. They were used in the parsers, since we needed to instanciate a DBContext in order to reflect over the object when deconstructing the compiled context to a design, but then I found the sneaky pseudo connection string ("App=EntityFramework") that tricks EF into being content without really connecting to a persistence mechanism. Seems Effort (and its dependency, NMemory) got left in the mix.

Good catch.

RuiAlias commented 4 years ago

Nice! I'm glad I could help.


Regarding the GeneratedVSCT.vsct problem, it appears to be that the line endings of GeneratedVSCT.tt on my clone were LF (Unix style) instead of CRLF (MS style). Changing the line endings to CRLF and rebuilding fixed the problem; i.e. it generated a GeneratedVSCT.vsct without blank lines.

To ensure that I hadn't (unintentionally) modified the file's line endings, I cloned the repository again and checked the line endings. They were LF again. I assumed this had to do with Git's autocrlf configs (which might be poorly configured on my end) and indeed configuring the line ending normalization via a .gitattributes[1][2][3] file fixes the issue.

I'll open a PR that fixes this with a .gitattributes file.

[1] - https://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/ [2] - https://rehansaeed.com/gitattributes-best-practices/ [3] - https://git-scm.com/docs/gitattributes

msawczyn commented 4 years ago

Thanks.