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
I did some experiments with the Nuget package and got the following warning during build (using .net 8 console application):
[NU1701] Package 'Draco_transcoder 3.3.4' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net8.0'. This package may not be fully compatible with your project.
Or do you think that there is any other easy fix for this problem?
Maybe this is also related to an x86 <--> x64 issue.
Currently I cannot use the Nuget at all when I for example try to execute the code from your documentation I get a: Unhandled exception. System.BadImageFormatException: Could not load file or assembly '*/bin/Debug/net8.0/DracoWrapper.dll'. An attempt was made to load a program with an incorrect format.
@awesomeinsight I have already updated the package to work with .net core, but the issue that you are mentioning is not due to the framework version but a problem related to the mixed-use of unmanaged Code(c++) and managed Code(C#).
I experienced the same problem and endep up solving it in the following way:
public class NonCollectibleAssemblyLoadContext : AssemblyLoadContext
{
public NonCollectibleAssemblyLoadContext() : base(isCollectible: false)
{
}
}
var loadContext = new NonCollectibleAssemblyLoadContext();
var assemblyPath = @"C:\location\of\your\dll\DracoWrapper.dll";
Assembly mixedModeAssembly = loadContext.LoadFromAssemblyPath(assemblyPath);
var gltfDecoderType = mixedModeAssembly.GetType("dracowrapper.GltfDecoder");
var gltfDecoderInstance = Activator.CreateInstance(gltfDecoderType);
var decodeFromFileToSceneMethod = gltfDecoderType.GetMethod("DecodeFromFileToScene");
var res = decodeFromFileToSceneMethod.Invoke(gltfDecoderInstance, new object[] { fileToCompress });
var resType = res.GetType();
var valueMethod = resType.GetMethod("Value");
var scene = valueMethod.Invoke(res, null);
var dracoCompressionOptionsType = mixedModeAssembly.GetType("dracowrapper.DracoCompressionOptions");
var dracoCompressionOptionsInstance = Activator.CreateInstance(dracoCompressionOptionsType);
var sceneUtilsType = mixedModeAssembly.GetType("dracowrapper.SceneUtils");
var setDracoCompressionOptionsMethod = sceneUtilsType.GetMethod("SetDracoCompressionOptions");
setDracoCompressionOptionsMethod.Invoke(null, new object[] { dracoCompressionOptionsInstance, scene });
var gltfEncoderType = mixedModeAssembly.GetType("dracowrapper.GltfEncoder");
var gltfEncoderInstance = Activator.CreateInstance(gltfEncoderType);
var encodeSceneToFileMethod = gltfEncoderType.GetMethod("EncodeSceneToFile");
encodeSceneToFileMethod.Invoke(gltfEncoderInstance, new object[] { scene, fileToCompressTemp });
thanks anyway!
yes, the limitation is due to the mix compilation, as i've mentioned in #4 , which makes this wrapper not-so-ideally works under windows only.
Activity
[-]Compatibility issues NuGet restore[/-][+]Compatibility issues Nuget restore[/+]rosend commentedon Apr 22, 2024
i had the same problem :(
xiaoyuvax commentedon Jun 17, 2024
same problem
Can this project owner make it compatible with net core and above?
vnoves commentedon Jul 11, 2024
@awesomeinsight I have already updated the package to work with .net core, but the issue that you are mentioning is not due to the framework version but a problem related to the mixed-use of unmanaged Code(c++) and managed Code(C#).
I experienced the same problem and endep up solving it in the following way:
I hope this helps
vnoves commentedon Jul 11, 2024
@xiaoyuvax I have already updated the NuGet version 3.5.0 to be compatible with .net core
xiaoyuvax commentedon Jul 11, 2024
thanks anyway!
yes, the limitation is due to the mix compilation, as i've mentioned in #4 , which makes this wrapper not-so-ideally works under windows only.
Recently i've already seen pure C# port of Google Draco (only Draco, not Draco-ed glTF), check it out here: https://github.com/fileformat-drako/FileFormat.Drako-for-.NET, and it is hopefully to be a more cross-platform-able solution.