Skip to content

Adding a project reference makes IL2CPU not be able to find the file #2947

Open
@9xbt

Description

@9xbt

Have you checked Github Issues for similar errors?
Yes

Exception

System.IO.FileLoadException: Could not load file or assembly 'SVGAIITerminal, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Visual Studio Output Logs

Operación Compilar iniciada..
1>------ Operación Compilar iniciada: Proyecto: TestKernel, configuración: Debug Any CPU ------
1>C:\Users\Eric\source\repos\TestKernel\TestKernel\TestKernel.csproj : warning NU1603: PrismAPI 1.0.3 depende de Cosmos.HAL2 (>= 0.1.0-localbuild), pero no se encontró Cosmos.HAL2 0.1.0-localbuild. Se resolvió una mejor coincidencia aproximada de Cosmos.HAL2 0.1.0-localbuild20240208033845.
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3270: La arquitectura del procesador del proyecto que se va a compilar "MSIL" y la arquitectura del procesador de la referencia "C:\Users\Eric\Documents\GitHub\SVGAIITerminal\src\bin\Debug\net6.0\SVGAIITerminal.dll", "x86", no coinciden. Esta falta de coincidencia puede causar errores en tiempo de ejecución. Cambie la arquitectura del procesador de destino del proyecto mediante el Administrador de configuración para alinear las arquitecturas de procesador entre el proyecto y las referencias, o tome una dependencia de las referencias con una arquitectura de procesador que coincida con la arquitectura del procesador de destino del proyecto.
1>C:\Users\Eric\Documents\GitHub\SVGAIITerminal\src\SVGAIITerminal.csproj : warning NU1603: PrismAPI 1.0.3 depende de Cosmos.HAL2 (>= 0.1.0-localbuild), pero no se encontró Cosmos.HAL2 0.1.0-localbuild. Se resolvió una mejor coincidencia aproximada de Cosmos.HAL2 0.1.0-localbuild20240208033845.
1>Compilación del proyecto "SVGAIITerminal.csproj" terminada.
1>TestKernel -> C:\Users\Eric\source\repos\TestKernel\TestKernel\bin\Debug\net6.0\TestKernel.dll
1>Error : error occurred: System.IO.FileLoadException: Could not load file or assembly 'SVGAIITerminal, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
1>   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
1>   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
1>   at Cosmos.IL2CPU.IsolatedAssemblyLoadContext..ctor(IEnumerable`1 assemblyPaths) in C:\Users\Eric\Documents\GitHub\Cosmos\IL2CPU\source\Cosmos.IL2CPU\IsolatedAssemblyLoadContext.cs:line 43
1>   at Cosmos.IL2CPU.CompilerEngine..ctor(ICompilerEngineSettings aSettings) in C:\Users\Eric\Documents\GitHub\Cosmos\IL2CPU\source\Cosmos.IL2CPU\CompilerEngine.cs:line 91
1>   at Cosmos.IL2CPU.Program.RunCompilerEngine(String[] aArgs, Action`1 aLogMessage, Action`1 aLogError) in C:\Users\Eric\Documents\GitHub\Cosmos\IL2CPU\source\Cosmos.IL2CPU\Program.cs:line 64
1>   at Cosmos.IL2CPU.Program.Run(String[] aArgs, Action`1 aLogMessage, Action`1 aLogError) in C:\Users\Eric\Documents\GitHub\Cosmos\IL2CPU\source\Cosmos.IL2CPU\Program.cs:line 47
1>IL2CPU task took 00:00:00.1008798
1>Compilación del proyecto "TestKernel.csproj" terminada -- ERROR.
========== Compilación: 0 correcto, 1 erróneo, 1 actualizado, 0 omitido ==========
========= Compilar se inició en 12:40 PM y tomó 00.476 segundos ==========

How To Reproduce
Add a reference to a project in VS

Screenshots

Context
Before posting please confirm that the following are in order
[Y] Both Cosmos VS Extensions are installed
[Y] In the NuGet Package Manager "Include prerelease" is selected
[Y] The Cosmos NuGet package store is selected (NOT nuget.org) in 'Manage NuGet Packages'
[Y] The Cosmos NuGet packages are installed

How to solve
Instead of doing this (which is what VS does by default)

<ItemGroup>
    <ProjectReference Include="..\..\..\..\Documents\GitHub\SVGAIITerminal\src\SVGAIITerminal.csproj" />
</ItemGroup>

Do this

<ItemGroup>
    <ProjectReference Include="..\..\..\Documents\GitHub\SVGAIITerminal\src\SVGAIITerminal.csproj" />
</ItemGroup>

For context, IL2CPU seems to be adding an extra ..\ before the project reference path which is not right

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions