OData / odata.net

ODataLib: Open Data Protocol - .NET Libraries and Frameworks
https://docs.microsoft.com/odata
Other
686 stars 349 forks source link

Support VS2019 with the client code generator #1485

Closed weitzhandler closed 4 years ago

weitzhandler commented 5 years ago

The latest version (7.5.0) of the OData v4 Client Code Generator extension doesn't not support VS2019. Can you please enable that?

Thank you!

cilerler commented 5 years ago

@mikepizzo Why we always end up short on the client side of the OData (javascript, blazor, vscode, vs2019) Would you mind discussing this subject on your next meeting, please? Thank you very much in advance 🙏

@raheph would you; please make this priority since It will not take more than 5-minute to fix

When I update files in VSIX as below

extension.vsixmanifest

  <Installation>
    <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[14.0, 17.0)" />
  </Installation>
  <Prerequisites>
    <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,17.0)" DisplayName="Visual Studio core editor" />
  </Prerequisites>

manifest.json

    "dependencies": {
        "Microsoft.VisualStudio.Component.CoreEditor": "[15.0,17.0)"
    }

it throws

7/1/2019 6:48:24 AM - Beginning to install extension to Visual Studio Enterprise 2019...
7/1/2019 6:48:31 AM - Install Error : Microsoft.VisualStudio.ExtensionManager.MissingReferencesException: This extension cannot be installed because the following references are missing:
-Microsoft.VisualStudio.Component.CoreEditor (Microsoft.VisualStudio.Component.CoreEditor)
   at Microsoft.VisualStudio.ExtensionManager.EngineUtilities.EnsureNoMissingReferences(IEnumerable`1 missingRefs)
   at Microsoft.VisualStudio.ExtensionManager.PackageInstaller.PrepareEngineInstall(IDependencyGraph dGraph, IDependencyComparisonSeed seed, Component vsixComponent, Boolean isProductComponent, Int32& totalInstallationSteps)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.PerformSetupEngineInstall(InstallableExtensionImpl extension, Boolean installPerMachine, Boolean isPackComponent, IDictionary`2 extensionsInstalledSoFar, List`1 extensionsUninstalledSoFar, IInstalledExtensionList modifiedInstalledExtensionsList, IProgress`1 progress, InstallFlags installFlags, AsyncOperation asyncOp, Version targetedVsVersion, IInstalledExtension& newExtension)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.InstallInternal(InstallableExtensionImpl extension, InstallFlags installFlags, IDictionary`2 extensionsInstalledSoFar, List`1 extensionsUninstalledSoFar, IInstalledExtensionList modifiedInstalledExtensionsList, AsyncOperation asyncOp, IProgress`1 progress, Version targetedVsVersion)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.BeginInstall(IInstallableExtension installableExtension, InstallFlags installFlags, AsyncOperation asyncOp, Version targetedVsVersion)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.InstallWorker(IInstallableExtension extension, InstallFlags installFlags, AsyncOperation asyncOp)

I found the same issue in here https://github.com/dotnet/project-system/issues/4462 but no luck about fixing it.

🥇 Finally figured it out, there was one missing place.

catalog.json

            "dependencies": {
                "Microsoft.VisualStudio.Component.CoreEditor": "[15.0,17.0)"
            },

Well, it worked but still, it had better fix it in the source code.

negue commented 4 years ago

I changed all places like explained by @cilerler but its still not able to install it

cilerler commented 4 years ago

Remove the .zip part, and try this one, please.

ODataT4ItemTemplate.7.5.1.vsix.zip

negue commented 4 years ago

Worked, thanks!

1Jesper1 commented 4 years ago

Thanks, it works! Please upload a Visual Studio 2019 version to the marketplace https://marketplace.visualstudio.com/items?itemName=bingl.ODatav4ClientCodeGenerator

cfeilen commented 4 years ago

Any plan to get this updated on the Marketplace?

paulodero commented 4 years ago

@cfeilen You could also consider using OData Connected Service for code generation and it currently supports VS 2019.

paulodero commented 4 years ago

@weitzhandler The recommended code generator tool is now OData Connected Service which has all the features available in OData Client Code Generator.In addition it has support for VS 2019. We will therefore close this issue. Please register an issue in Connected Service Repo incase you face challenges.

weitzhandler commented 4 years ago

Thank you for the update, and thank you and the rest of the team for the great effort ❤

As a LoB app developer, OData has always been one of the most important parts in programming to me. I'm super excited to see OData is reviving, and hopefully will soon become as what RIA services used to be in those days.

Anyway, if I may ask, back at the day, I got recommendations here to use Simple.OData.Client or other clients and generators out there. Now, since Microsoft has recently started taking care of OData client-side, and especially since Simple.OData.Client is pretty neglected and dead, did the current recommendation switch to this extension? See also my question here.

paulodero commented 4 years ago

@weitzhandler Thanks for the feedback. Yes, it is recommended to use Microsoft OData Connected Service and Microsoft.OData.Client for your client development since we are committed in supporting these libraries going forward.

1Jesper1 commented 4 years ago

@paulodero Do you know if this problem exist when using OData Connected Service? https://github.com/OData/odata.net/issues/1396

ebekker commented 4 years ago

Is there any tooling (Client Code Generator, Connected Service, something else?) that supports generating the client model/proxies from a command line or CI build (i.e. non-UI driven)?

KanishManuja-MS commented 4 years ago

@ebekker You can try something along the lines of this - https://romiller.com/2013/05/15/running-ef-t4-code-generation-templates-from-command-line/

Basically, the code generator is a TT4 tool. You can try using TextTransform.exe to run it from command line. Do let us know how that worked out.

ebekker commented 4 years ago

Funny you mention that -- along the same lines I've already been expanding upon the EFCore.TextTemplating project from @bricelam -- it's a T4-based version of the EF Core scaffolding tooling. I've used it to generate the EF Core model along with context and related components.

The OData piece is related to (and derived from) that, so I guess I can just pull in the related template code from the Connected Service project.

mkalinovTC commented 2 years ago

@weitzhandler The recommended code generator tool is now OData Connected Service which has all the features available in OData Client Code Generator.In addition it has support for VS 2019. We will therefore close this issue. Please register an issue in Connected Service Repo incase you face challenges.

The connected service fails on big metadata files. Code generator still can process them. Shame we don't have it in vs2019

ElizabethOkerio commented 2 years ago

@mkalinovTC you can try the OData Cli. You can try the dotnet tool https://www.nuget.org/packages/Microsoft.OData.Cli/ or the exe: https://www.nuget.org/packages/Microsoft.OData.Cli.Exe whichever that works for you.

ElizabethOkerio commented 2 years ago

Also, when working with huge metadata files in the connected service, there is an option to split the huge file into multiple files: Check out this https://learn.microsoft.com/en-us/odata/connectedservice/generating-multiple-files on how to use the feature.

mkalinovTC commented 2 years ago

Thanks @ElizabethOkerio