Unity projects deploy Visual Studio 2022 errors

I’m trying to deploy a project from unity into the Hololens 2 but every time I obtain a bunch of error.
here the output log

Build started…
1>------ Build started: Project: Il2CppOutputProject, Configuration: Release x64 ------
1>Building GameAssembly.dll with MsvcWinRtToolChain
1> Msvc Install Version: 17.0
1> Msvc Install SDK Directory: C:\Program Files (x86)\Windows Kits\10
1> Msvc Linker Path: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\link.exe
1> Msvc Compiler Path: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\cl.exe
1>
1> Output directory: C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\build\bin\x64\Release
1> Cache directory: C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\build\obj\il2cppOutputProject\x64\Release
1>EXEC : error : Unity.IL2CPP.Building.BuilderFailedException: Lump_libil2cpp_vm.cpp
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\utils/Il2CppHashMap.h(71): error C2039: ‘hash_compare’: is not a member of ‘stdext’
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\iterator(1426): note: see declaration of ‘stdext’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\utils/Il2CppHashMap.h(71): error C2065: ‘hash_compare’: undeclared identifier
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\utils/Il2CppHashMap.h(71): error C2275: ‘Key’: expected an expression instead of a type
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(37): error C2976: ‘Il2CppReaderWriterLockedHashMap’: too few template arguments
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\utils/Il2CppHashMap.h(75): note: see declaration of ‘Il2CppReaderWriterLockedHashMap’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(37): error C2974: ‘Il2CppReaderWriterLockedHashMap’: invalid template argument for ‘HashFcn’, type expected
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\utils/Il2CppHashMap.h(75): note: see declaration of ‘Il2CppReaderWriterLockedHashMap’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(378): error C2662: ‘bool Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::TryGet(const Il2CppHashMap<Key,T,HashFcn,EqualKey,Alloc>::key_type &,T *)’: cannot convert ‘this’ pointer from ‘PointerTypeMap’ to ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc> &’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(378): note: Reason: cannot convert from ‘PointerTypeMap’ to ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(378): note: Conversion requires a second user-defined-conversion operator or constructor
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\utils/Il2CppHashMap.h(90): note: see declaration of ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::TryGet’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(378): note: while trying to match the argument list ‘(Il2CppClass *, Il2CppClass **)’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(431): error C2662: ‘bool Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::Add(const Il2CppHashMap<Key,T,HashFcn,EqualKey,Alloc>::key_type &,const T &)’: cannot convert ‘this’ pointer from ‘PointerTypeMap’ to ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc> &’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(431): note: Reason: cannot convert from ‘PointerTypeMap’ to ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(431): note: Conversion requires a second user-defined-conversion operator or constructor
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\utils/Il2CppHashMap.h(102): note: see declaration of ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::Add’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(431): note: while trying to match the argument list ‘(Il2CppClass *, Il2CppClass *)’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(1049): error C2955: ‘Il2CppReaderWriterLockedHashMap’: use of class template requires template argument list
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\utils/Il2CppHashMap.h(75): note: see declaration of ‘Il2CppReaderWriterLockedHashMap’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(1049): error C2662: ‘Il2CppHashMap<Key,T,HashFcn,EqualKey,Alloc>::iterator Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::UnlockedBegin(void)’: cannot convert ‘this’ pointer from ‘PointerTypeMap’ to ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc> &’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(1049): note: Reason: cannot convert from ‘PointerTypeMap’ to ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(1049): note: Conversion requires a second user-defined-conversion operator or constructor
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\utils/Il2CppHashMap.h(121): note: see declaration of ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::UnlockedBegin’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(1049): note: while trying to match the argument list ‘()’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(1049): error C2662: ‘Il2CppHashMap<Key,T,HashFcn,EqualKey,Alloc>::iterator Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::UnlockedEnd(void)’: cannot convert ‘this’ pointer from ‘PointerTypeMap’ to ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc> &’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(1049): note: Reason: cannot convert from ‘PointerTypeMap’ to ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(1049): note: Conversion requires a second user-defined-conversion operator or constructor
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\utils/Il2CppHashMap.h(127): note: see declaration of ‘Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::UnlockedEnd’
1>C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\vm\MetadataCache.cpp(1049): note: while trying to match the argument list ‘()’
1>
1>Invocation was: Executable: “C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\cl.exe”
1>Arguments: “C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\Source\lumpedcpp\Lump_libil2cpp_vm.cpp” /nologo /c /bigobj /W3 /Z7 /EHs /GR- /Gy /utf-8 /wd4102 /wd4800 /wd4056 /wd4190 /wd4723 /wd4467 /wd4503 /wd4996 /wd4200 /wd4834 /Ox /Oi /Oy- /GS- /Gw /GF /Zo /MD /DWINDOWS_UWP /DUNITY_UWP /DUNITY_WSA_10_0 /DUNITY_WSA /DUNITY_WINRT /DPLATFORM_WINRT /DNET_4_0 /DUNITY_AOT /DIL2CPP_MONO_DEBUGGER_DISABLED /DGC_NOT_DLL /DRUNTIME_IL2CPP /DIL2CPP_ENABLE_WRITE_BARRIERS=1 /DIL2CPP_INCREMENTAL_TIME_SLICE=3 /DBASELIB_INLINE_NAMESPACE=il2cpp_baselib /DIL2CPP_DEFAULT_DATA_DIR_PATH=Data/il2cpp_data /D_WIN32 /DWIN32 /DWIN32_THREADS /D_WINDOWS /DWINDOWS /D_UNICODE /DUNICODE /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS /D_WINSOCK_DEPRECATED_NO_WARNINGS /DNOMINMAX /D_NDEBUG /DNDEBUG /DWINDOWS_SDK_BUILD_VERSION=22621 /D__WRL_NO_DEFAULT_LIB__ /DWINAPI_FAMILY=WINAPI_FAMILY_APP /I"C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp" /I"C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp" /I"C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\external\bdwgc\include" /I"C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\external\xxHash" /I"C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\external\baselib\Include" /I"C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\external\baselib\Platforms\UniversalWindows\Include" /I"C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\libil2cpp\pch" /I"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt" /Fo"C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\build\obj\il2cppOutputProject\x64\Release\libil2cpp\68D59D552110A41AD6D7E39F339562DD.obj" /Fd"C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\build\obj\il2cppOutputProject\x64\Release\libil2cpp\68D59D552110A41AD6D7E39F339562DD.pdb"
1>EnvArg key: PATH value: C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64
1>
1> at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector) 1> at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) 1> at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection1 matchedAssemblyMethodSourceFiles)
1> at il2cpp.Program.DoRun(String[ ] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions)
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(45,5): error MSB3073: The command ““C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\build\deploy\netcoreapp3.1\il2cpp.exe” --libil2cpp-static --compile-cpp -architecture=x64 -configuration=Release -platform=winrt -outputpath=“C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\build\bin\x64\Release\GameAssembly.dll” --data-folder=“C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\build\bin\x64\Release\” -cachedirectory=“C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\build\obj\il2cppOutputProject\x64\Release\” -generatedcppdir=“C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\Source” --incremental-g-c-time-slice=3 --baselib-directory=“C:\Program Files\Unity\Hub\Editor\2020.3.41f1\Editor\Data\PlaybackEngines\MetroSupport\Players\UAP\il2cpp\x64\Release” --avoid-dynamic-library-copy --profiler-report --additional-defines=WINDOWS_UWP --additional-defines=UNITY_UWP --additional-defines=UNITY_WSA_10_0 --additional-defines=UNITY_WSA --additional-defines=UNITY_WINRT --additional-defines=PLATFORM_WINRT -dotnetprofile=unityaot -verbose --relative-data-path=Data/il2cpp_data --map-file-parser=“C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\Il2CppOutputProject\IL2CPP\MapFileParser\MapFileParser.exe”” exited with code 4.
1>Done building project “Il2CppOutputProject.vcxproj” – FAILED.
2>------ Build started: Project: Test for deploy, Configuration: Release x64 ------
2>LINK : fatal error LNK1181: cannot open input file ‘C:\Users\spoggesi\Test for deploy\Builds\test for the deploy\build\bin\x64\Release\GameAssembly.lib’
2>Done building project “Test for deploy.vcxproj” – FAILED.
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
========== Elapsed 00:18.084 ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
========== Elapsed 00:18.086 ==========

This is a known issue with Visual Studio 17.4. You can work around it here: Workaround for building with IL2CPP with Visual Studio 2022 17.4

There is a fix on the way to all Unity release versions. You can track the status of the fix here: Unity Issue Tracker - [IL2CPP] Windows builds fails when using VS 2022 17.4.0 Preview

1 Like

Thank you so much.
I will read from your suggestion to find a solution.

1 Like