I have recently migrated a Net.Framework 4.7 project to a Net.Core 3.1 project. In this project we used linked assemblies (I dont know if it is the rigth term, sorry). After the Migration this feature doesnot seem to work. I always get System.IO.FileNotFoundException. Here a short example what i am trying to achief. I got a Consoleapplication A
A.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>C:\Test\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="B">
<HintPath>C:\Test\Lib\B.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
</Project>
Code from A:
using B;
using System;
namespace A
{
class Program
{
static void Main(string[] args)
{
Dummy B = new Dummy();
Console.WriteLine(B.text);
}
}
}
with needs the class library B
using System;
namespace B
{
public class Dummy
{
public string text = "Hello World";
}
}
to function. I have signed B and set the Outputpath from it to C:\Test\Lib\ . After that i created a App.config File
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<linkedConfiguration href="FILE://C:/Test/A.config" />
</assemblyBinding>
</configuration>
in which i linked the A.Config File.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="B" culture="neutral" publicKeyToken="ff852e2ba657dc56" />
<codeBase version="1.0.0.0" href="FILE://C:/Test/Lib/B.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Here is a picture of the Developer Command Prompt for the public key.
Here is a picture of the Exception.
Here is a picture of the folder Test.
Here is a picture of the folder Lib.
Goal for this hole procedure is to have a assembly only one time in a specific folder and no local copies. Thank you for your help.