Building .NET 4.6.1 library which references NETStandard library: FileNotFoundException for System.Runtime, preceeded by PS0220 every build (5.0.29+)

kierenj's Avatar

kierenj

31 Jul, 2017 07:02 AM

Hi,

On our build server (only - works fine locally), I get:

[PostSharp30] unknown error PS0099: Unhandled exception (5.0.29.0, postsharp-net40-x86-native.exe, CLR 4.0.30319.394271, Release): PostSharp.Sdk.CodeModel.BindingException: Error while loading the type "Xxx.Yyy.Auth.ICallerId, Xxx.Yyy.Auth, Version=3.3.1.0, Culture=neutral, PublicKeyToken=null": System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

There's a warning in the binding log:

[PostSharp30] unknown error PS0099: LOG:     (ClrHost) IsAssemblyReferenceInList: Requesting System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[07:40:46][PostSharp30] unknown error PS0099: LOG:  (ClrHost) IsAssemblyReferenceInList: found in cache: loaded by CLR = 1.
[07:40:46][PostSharp30] unknown error PS0099: LOG:  (ClrHost) ProvideAssembly: "system.runtime, version=4.1.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86".
[07:40:46][PostSharp30] unknown error PS0099: LOG:  Finding runtime assembly with binding identity 'system.runtime, version=4.1.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86'.
[07:40:46][PostSharp30] unknown error PS0099: LOG:  Post-policy assembly binding identity is: system.runtime, version=4.1.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.
[07:40:46][PostSharp30] unknown error PS0099: LOG:  Looking in GAC for system.runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86.
[07:40:46][PostSharp30] unknown error PS0099: LOG:  Found file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' with identity 'system.runtime, version=4.0.20.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a'.
[07:40:46][PostSharp30] unknown error PS0099: LOG:  Reference mismatch for 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' [ProcessorArchitectureMismatch]

There are a lot more probes/logs and failures (just picked out the errors):

[PostSharp30] unknown error PS0099: LOG:     Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.exe' because this directory was explicitly added to the search path [File Not Found].
[08:08:39][PostSharp30] unknown error PS0099: LOG:  Found file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' with identity 'system.runtime, version=4.0.20.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a'.
[08:08:39][PostSharp30] unknown error PS0099: LOG:  Reference mismatch for 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' [ProcessorArchitectureMismatch].
[PostSharp30] unknown error PS0099: LOG:     Looking in GAC for system.runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=msil.
[08:08:39][PostSharp30] unknown error PS0099: LOG:  Found file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' with identity 'system.runtime, version=4.0.20.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a'.
[08:08:39][PostSharp30] unknown error PS0099: LOG:  Reference mismatch for 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' [ProcessorArchitectureMismatch].
[PostSharp30] unknown error PS0099: LOG:     Found file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' with identity 'system.runtime, version=4.0.20.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a'.
[08:08:40][PostSharp30] unknown error PS0099: LOG:  Reference mismatch for 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' [ProcessorArchitectureMismatch].
[PostSharp30] unknown error PS0099: LOG:     Found file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' with identity 'system.runtime, version=4.0.20.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a'.
[08:08:40][PostSharp30] unknown error PS0099: LOG:  Reference mismatch for 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' [VersionMismatch].
[PostSharp30] unknown error PS0099: LOG:     Found file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' with identity 'system.runtime, version=4.0.20.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a'.
[08:08:40][PostSharp30] unknown error PS0099: LOG:  Reference mismatch for 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' [VersionMismatch].
[PostSharp30] unknown error PS0099: LOG:     Found file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' with identity 'system.runtime, version=4.0.20.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a'.
[08:08:40][PostSharp30] unknown error PS0099: LOG:  Reference mismatch for 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' [VersionMismatch].
[PostSharp30] unknown error PS0099: LOG:     Found file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' with identity 'system.runtime, version=4.0.20.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a'.
[08:08:40][PostSharp30] unknown error PS0099: LOG:  Reference mismatch for 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll' [VersionMismatch].

I get the feeling this may be the crux of the issue, but I'm not sure what it means / what a solution would be?

Immediately before this is a PS0220, if that makes any difference:

[PostSharp30] unknown : message PS0220: PostSharp needs to generate assembly binding maps for .NETFramework,Version=v4.6.1. This could take a few seconds. The result will be cached and the next build will be faster. Reason: missing assemblies: Accessibility, CustomMarshalers, ISymWrapper, Microsoft.Activities.Build, Microsoft.CSharp, Microsoft.JScript, Microsoft.VisualBasic, Microsoft.VisualBasic.Compatibility, Microsoft.VisualBasic.Compatibility.Data, Microsoft.VisualC, Microsoft.VisualC.STLCLR, mscorlib, PresentationBuildTasks, PresentationCore, PresentationFramework, PresentationFramework.Aero, PresentationFramework.Aero2, PresentationFramework.AeroLite, ReachFramework, sysglobl, System, System.Activities, System.Activities.Core.Presentation, System.Activities.DurableInstancing, System.Activities.Presentation, System.AddIn, System.AddIn.Contract, System.Collections, System.Collections.Concurrent, System.ComponentModel, System.ComponentModel.Annotations, System.ComponentModel.Composition, System.ComponentModel.Composition.Registration, System.ComponentModel.DataAnnotations, System.ComponentModel.EventBasedAsync, System.Configuration, System.Configuration.Install, System.Core, System.Data, System.Data.DataSetExtensions, System.Data.Entity, System.Data.Entity.Design, System.Data.Linq, System.Data.OracleClient, System.Data.Services, System.Data.Services.Client, System.Data.Services.Design, System.Data.SqlXml, System.Deployment, System.Design, System.Device, System.Diagnostics.Contracts, System.Diagnostics.Debug, System.Diagnostics.Tools, System.Diagnostics.Tracing, System.DirectoryServices, System.DirectoryServices.AccountManagement, System.DirectoryServices.Protocols, System.Drawing, System.Drawing.Design, System.Dynamic, System.Dynamic.Runtime, System.EnterpriseServices, System.Globalization, System.IdentityModel, System.IdentityModel.Selectors, System.IdentityModel.Services, System.IO, System.IO.Compression, System.IO.Compression.FileSystem, System.IO.Log, System.Linq, System.Linq.Expressions, System.Linq.Parallel, System.Linq.Queryable, System.Management, System.Management.Instrumentation, System.Messaging, System.Net, System.Net.Http, System.Net.Http.WebRequest, System.Net.NetworkInformation, System.Net.Primitives, System.Net.Requests, System.Net.WebHeaderCollection, System.Numerics, System.Numerics.Vectors, System.ObjectModel, System.Printing, System.Reflection, System.Reflection.Context, System.Reflection.Emit, System.Reflection.Emit.ILGeneration, System.Reflection.Emit.Lightweight, System.Reflection.Extensions, System.Reflection.Primitives, System.Resources.ResourceManager, System.Runtime, System.Runtime.Caching, System.Runtime.DurableInstancing, System.Runtime.Extensions, System.Runtime.Handles, System.Runtime.InteropServices, System.Runtime.InteropServices.WindowsRuntime, System.Runtime.Numerics, System.Runtime.Remoting, System.Runtime.Serialization, System.Runtime.Serialization.Formatters.Soap, System.Runtime.Serialization.Json, System.Runtime.Serialization.Primitives, System.Runtime.Serialization.Xml, System.Security, System.Security.Principal, System.ServiceModel, System.ServiceModel.Activation, System.ServiceModel.Activities, System.ServiceModel.Channels, System.ServiceModel.Discovery, System.ServiceModel.Duplex, System.ServiceModel.Http, System.ServiceModel.NetTcp, System.ServiceModel.Primitives, System.ServiceModel.Routing, System.ServiceModel.Security, System.ServiceModel.Web, System.ServiceProcess, System.Speech, System.Text.Encoding, System.Text.Encoding.Extensions, System.Text.RegularExpressions, System.Threading, System.Threading.Tasks, System.Threading.Tasks.Parallel, System.Threading.Timer, System.Transactions, System.Web, System.Web.Abstractions, System.Web.ApplicationServices, System.Web.DataVisualization, System.Web.DataVisualization.Design, System.Web.DynamicData, System.Web.DynamicData.Design, System.Web.Entity, System.Web.Entity.Design, System.Web.Extensions, System.Web.Extensions.Design, System.Web.Mobile, System.Web.RegularExpressions, System.Web.Routing, System.Web.Services, System.Windows, System.Windows.Controls.Ribbon, System.Windows.Forms, System.Windows.Forms.DataVisualization, System.Windows.Forms.DataVisualization.Design, System.Windows.Input.Manipulations, System.Windows.Presentation, System.Workflow.Activities, System.Workflow.ComponentModel, System.Workflow.Runtime, System.WorkflowServices, System.Xaml, System.Xml, System.Xml.Linq, System.Xml.ReaderWriter, System.Xml.Serialization, System.Xml.XDocument, System.Xml.XmlSerializer, UIAutomationClient, UIAutomationClientsideProviders, UIAutomationProvider, UIAutomationTypes, WindowsBase, WindowsFormsIntegration, XamlBuildTask.

On my desktop machine, the resolution is

C:\Program Files (x86)\Microsoft Visual Studio\Preview\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\ref\System.Runtime.dll".

That folder doesn't exist on the server (despite VS2017 15.3 preview 6 being installed)

One difference is that on my desktop machine, PS runs in PipeServer mode - on the build server, it's Native. Adding a PostSharpHost property does nothing, and verbose MSBuild output shows that the parameter isn't parsed by the task.

  1. Support Staff 1 Posted by PostSharp Techn... on 03 Aug, 2017 03:23 PM

    PostSharp Technologies's Avatar

    Hello,

    This issue can be caused by a bug in our binding maps component and we will need to gather more information in that case.

    First, please ensure that you have .NET 4.6.1 Targeting Pack installed on development and build server machines. (https://www.microsoft.com/en-us/download/details.aspx?id=49978)

    If this doesn't solve the issue, then we would like to ask you for a detailed MSBuild log from the build server. Also we would like to ask what is the version of NETStandard that the referenced library is targeting?

    -alex

  2. Support Staff 2 Posted by PostSharp Techn... on 21 Aug, 2017 12:03 PM

    PostSharp Technologies's Avatar

    Hello,

    We are going to close this request as there have not been any further updates. Please feel free to reopen the discussion if you need more help.

    Thanks,
    PostSharp Team

  3. PostSharp Technologies closed this discussion on 21 Aug, 2017 12:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac