aaubry / YamlDotNet

YamlDotNet is a .NET library for YAML
MIT License
2.56k stars 482 forks source link

Broken references for .NET Framework 4.0 assemblies #305

Closed evgeni-nabokov closed 6 years ago

evgeni-nabokov commented 6 years ago

Hello! I have run into a problem -- can't compile the solution. I am trying to build master branch in VS 2017 Community 15.6.1. There are broken ("empty") references to System & System.Core assemblies related to .NET Framework 4.0. I have .NET Core 2.1.100 installed on Windows 10 1709. Screenshot of VS with the loaded solution. Any help is appreciated.

Here are first lines of build output: >C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2052,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2052,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Core". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. 1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2052,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\\mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. 1>C:\Users\Evgeni\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.cs(4,46,4,70): warning CS0436: The type 'TargetFrameworkAttribute' in 'C:\Dev\YamlDotNet\YamlDotNet\Helpers\Portability.cs' conflicts with the imported type 'TargetFrameworkAttribute' in 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using the type defined in 'C:\Dev\YamlDotNet\YamlDotNet\Helpers\Portability.cs'.

aaubry commented 6 years ago

Hello,

I have just tried compiling the solution on a cleanly installed Windows and VS 2017, and it worked without issues. The .NET 4.0 target is used to target Unity, and the Unity assemblies are located in the BuildUtils.UnityPrerequisites submodule. Maybe you did not checkout submodules when you cloned the solution?

evgeni-nabokov commented 6 years ago

@aaubry You were right, the reason of my problem was in lack of BuildUtils.UnityPrerequisites. Thank you for advice.