You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi.
Our .NET Core WPF App needs to interact with a 3rd-party API. These APIs are exposed via COM objects using a primary interop assembly, for development purposes, or via a NativeReference, by using their *.manifest file, for production-ready purposes.
This manifest is needed to make sure all the API assemblies are sitting next to any application consuming them, avoiding the registration of COM objects in the registry, but registering them instead on runtime.
When I build the app with Visual Studio 2022 17.2.6, targeting .NET Core 6.0.302, the output directory looks okay, but the content of its manifest (auto-generated) is the following:
As you can see, the "MyComReference.manifest" is instead correctly considered listed as a dependency.
In a few words, .NET Core lists a NativeReference in a WPF app like a file, but not as a dependency, like .NET Framework does.
To Reproduce
Create a solution with a WPF app targeting .NET Core 6 and another WPF app targeting .NET Framework 4.8;
Add a NativeReference to both projects;
Build both projects;
Inspect both apps' manifest files;
EXPECTED BEHAVIOUR:
Both manifest files list the NativeReference using <dependency> and <dependentAssembly> nodes.
CURRENT BEHAVIOUR:
The .NET Core's manifest file lists the NativeReference as a file, instead of a dependentAssembly, like .NET Framework does.
Exceptions (if any)
This issue causes our application not to correctly instantiate the COM objects, because of "Class not registered" error.
Without marking the NativeReference as a dependent assembly, the application doesn't load and register the COM objects.
Error: Unable to initialise TypeFromComReference.
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {AAA44754-CC81-4692-91AF-7064E58EB22A} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)).
at System.RuntimeTypeHandle.AllocateComObject(Void* pClassFactory)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
Further technical details
dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.302
Commit: c857713
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.302\
Describe the bug
Hi.
Our .NET Core WPF App needs to interact with a 3rd-party API. These APIs are exposed via COM objects using a primary interop assembly, for development purposes, or via a NativeReference, by using their *.manifest file, for production-ready purposes.
This manifest is needed to make sure all the API assemblies are sitting next to any application consuming them, avoiding the registration of COM objects in the registry, but registering them instead on runtime.
When I build the app with Visual Studio 2022 17.2.6, targeting .NET Core 6.0.302, the output directory looks okay, but the content of its manifest (auto-generated) is the following:
The above app's manifest reports the NativeReference ("MyComReference.manifest") as an extra file, but not as a dependency.
If I build the same app targeting .NET Framework 4.8 instead, its manifest will look like this instead:
As you can see, the "MyComReference.manifest" is instead correctly considered listed as a dependency.
In a few words, .NET Core lists a NativeReference in a WPF app like a file, but not as a dependency, like .NET Framework does.
To Reproduce
EXPECTED BEHAVIOUR:
Both manifest files list the NativeReference using
<dependency>
and<dependentAssembly>
nodes.CURRENT BEHAVIOUR:
The .NET Core's manifest file lists the NativeReference as a file, instead of a dependentAssembly, like .NET Framework does.
Exceptions (if any)
This issue causes our application not to correctly instantiate the COM objects, because of "Class not registered" error.
Without marking the NativeReference as a dependent assembly, the application doesn't load and register the COM objects.
Further technical details
.NET SDK (reflecting any global.json):
Version: 6.0.302
Commit: c857713
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.302\
global.json file:
Not found
Host:
Version: 6.0.7
Architecture: x64
Commit: 0ec02c8c96
.NET SDKs installed:
6.1.421 [C:\Program Files\dotnet\sdk]
7.0.214 [C:\Program Files\dotnet\sdk]
5.0.404 [C:\Program Files\dotnet\sdk]
5.0.408 [C:\Program Files\dotnet\sdk]
8.0.101 [C:\Program Files\dotnet\sdk]
6.0.107 [C:\Program Files\dotnet\sdk]
6.0.202 [C:\Program Files\dotnet\sdk]
6.0.203 [C:\Program Files\dotnet\sdk]
6.0.302 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
The text was updated successfully, but these errors were encountered: