Home Which target framework class will be compiled into when added as link?

# Which target framework class will be compiled into when added as link?

LP13
1#
LP13 Published in 2018-02-13 22:17:18Z
 I have NET Standard project with Person.cs file. Then I also have .NET Framework 4.6.2 library project. I have added Person.cs in .NET Framework 4.6.2 project as existing item and as a link from NETStandard project. ( because I wanted to keep same copy of person.cs in both the projects) The Person class in .NET Standard will get compiled with target framework .NET Standard, but will Person class in .NET Framework 4.6.2 get complied as .NET Framework 4.6.2?
NightOwl888
2#
 The person class in NETStandard will get compiled with target framework NETStandard, but will person class in .NET 4.6.2 get complied as .NET 4.6.2? Yes. BUT, the two Person classes will not be considered the same type by the .NET compiler. You won't be able to use an instance of Person from the NETStandardLib to assign a variable of type Person from the NET4.6.2Lib. If you want them to be considered the same type, delete the file link in NET4.6.2Lib, and add a NETStandardLib project reference to NET4.6.2Lib. All versions of .NET Standard can be consumed by .NET Framework 4.6.2, so this won't be a problem.