microsoft.netframework.referenceassemblies.net452 has incorrect version of System.Runtime
See original GitHub issueI’m using the microsoft.netframework.referenceassemblies version 1.0.0-preview.2 and when building against net452 I end up with the warning:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Runtime". Check to make sure the assembly exists on disk. If this reference is
required by your code, you may get compilation errors. [D:\adp\azure-sdk-for-net\sdk\resources\Microsoft.Azure.Management.Resource\src\Microsoft.Azure.Management.ResourceManager.csproj]
detailed log info:
Primary reference "System.Runtime". (TaskId:22)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Runtime". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\adp\azure-sdk-for-net\sdk\resources\Microsoft.Azure.Management.Resource\src\Microsoft.Azure.Management.ResourceManager.csproj]
For SearchPath "{TargetFrameworkDirectory}". (TaskId:22)
Considered "D:\adp\azure-sdk-for-net\restoredPackages\microsoft.netframework.referenceassemblies.net452\1.0.0-preview.2\build\.NETFramework\v4.5.2\System.Runtime.winmd", but it didn't exist. (TaskId:22)
Considered "D:\adp\azure-sdk-for-net\restoredPackages\microsoft.netframework.referenceassemblies.net452\1.0.0-preview.2\build\.NETFramework\v4.5.2\System.Runtime.dll", but it didn't exist. (TaskId:22)
Considered "D:\adp\azure-sdk-for-net\restoredPackages\microsoft.netframework.referenceassemblies.net452\1.0.0-preview.2\build\.NETFramework\v4.5.2\System.Runtime.exe", but it didn't exist. (TaskId:22)
Considered "D:\adp\azure-sdk-for-net\restoredPackages\microsoft.netframework.referenceassemblies.net452\1.0.0-preview.2\build\.NETFramework\v4.5.2\Facades\System.Runtime.winmd", but it didn't exist. (TaskId:22)
Considered "D:\adp\azure-sdk-for-net\restoredPackages\microsoft.netframework.referenceassemblies.net452\1.0.0-preview.2\build\.NETFramework\v4.5.2\Facades\System.Runtime.dll",
but its name "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
didn't match the expected name "System.Runtime". (TaskId:22)
Considered "D:\adp\azure-sdk-for-net\restoredPackages\microsoft.netframework.referenceassemblies.net452\1.0.0-preview.2\build\.NETFramework\v4.5.2\Facades\System.Runtime.exe", but it didn't exist. (TaskId:22)
For SearchPath "{RawFileName}". (TaskId:22)
Considered treating "System.Runtime" as a file name, but it didn't exist. (TaskId:22)
After digging into this more it appears that for some reason microsoft.netframework.referenceassemblies.net452 as an incorrect version of System.Runtime which causes this issue.
I diffed this System.Runtime vs what is installed with VS and there is a different assembly version:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\Facades\System.Runtime.dll
Has version 4.0.10.0
\microsoft.netframework.referenceassemblies.net452\1.0.0-preview.2\build\.NETFramework\v4.5.2\Facades\System.Runtime.dll
Has version 4.0.0.0
Which is what I believe is causing the warning.
I’ve not figured any way to suppress this warning as it doesn’t cause any breaks for me other then my warnaserror checks fail. So any potential way to suppress this would also work for my case.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Error message when you compile applications to target ...
The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, ...
Read more >Net picking wrong referenced assembly version
My guess is that another assembly you are using is referencing the old dll. Are you familiar with all of the other project...
Read more >Could not load file or assembly System.Runtime in NET4x
While working on a recent task, I wanted to include latest version of Autofac library and upgrade few other dependent libraries. So, I...
Read more >Microsoft.NETFramework.ReferenceAssemblies.net452 1.0.3
Microsoft .NET Framework Reference Assemblies.
Read more >Multi-targetting .Net Framework and .Net Core in a single project
error CS0012: The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This should now be fixed with the 1.0.0 release of the packages.
@NikolaMilosavljevic has there been some recent changes to the reference assemblies on nuget that might have regressed this? I’m asking because we started hitting this issue recently again when the DevOps agent installed a new version of VS (this update https://github.com/actions/virtual-environments/commit/f3ef24f13440c3d741a755cd713027ed5d2f9c95#diff-816219d3c9f30fcc1c40f88ca826c1662bf99eded781c1b419dd2dfb577ae227R235).