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

New project structure does not support metadata from D365 instance. #233

Open
thygesteffensen opened this issue May 4, 2024 · 1 comment

Comments

@thygesteffensen
Copy link
Member

Describe the bug
MetadataGenerator365.exe and MetadataGenerator365.exe.config is not added to the Metadata folder when using the "new" project file structure.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new empty solution.
  2. Create new test project using the "new" project file structure.

Not Metadata folder is generated.

Expected behavior
Metadata folder is generated with MetadataGenerator365.exe and MetadataGenerator365.exe.config.

Screenshots

Environment

  • Windows 11
  • Tool version: 1.12.3

Additional context
This is not using the XrmFramework project structure due to using XrmToolkit ofr plugin registration and "metadata" generating.

When moving the MetadataGenerator365.exe and MetadataGenerator365.exe.config to the manually created Metadata folder, the tool throws this exception:

.\MetadataGenerator365.exe

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Invalid pointer (Exception from HRESULT: 0x80004003 (E_POINTER)) ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at DG.Tools.XrmMockup.Metadata.AssemblyGetter.GetAssemblyFromName(String Name)
   at DG.Tools.XrmMockup.Metadata.Program.ResolveXrmAssemblies(Object sender, ResolveEventArgs args)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
   --- End of inner exception stack trace ---
   at DG.Tools.XrmMockup.Metadata.Program.GenerateMetadata()
   at DG.Tools.XrmMockup.Metadata.Program.Main(String[] args)

This is resolved by copying the Microsoft.* assemblies from bin/Release/net462 to the Metadata folder. It might be related, it might not or it might be me doing something wrong :|

@thygesteffensen
Copy link
Member Author

And I did add this "hack":

    <!-- This ItemGroup is only here because the assembly getter in XrmMockup is stupid -->
    <ItemGroup>
        <Reference Include="Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
            <HintPath>bin\Release\net462\Microsoft.Xrm.Sdk.dll</HintPath>
        </Reference>
        <Reference Include="Microsoft.Xrm.Tooling.Connector, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
            <HintPath>bin\Release\net462\Microsoft.Xrm.Tooling.Connector.dll</HintPath>
        </Reference>
        <Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=3.19.8.16603, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
            <HintPath>bin\Release\net462\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
        </Reference>
        <Reference Include="Microsoft.Crm.Sdk.Proxy, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
            <HintPath>bin\Release\net462\Microsoft.Crm.Sdk.Proxy.dll</HintPath>
        </Reference>
    </ItemGroup>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant