mardi 6 août 2019

MSBuild fail to build web site with reference a Bcl related library

I have 2 projects (.Net 4.0)

  • A class library (DataProvider)
    • Add reference to Bcl.Async library (via nuget)
    • Provide some async methods
  • A web site (SampleSite)
    • Reference to "DataProvider"

The problem:

  • When I build with Visual studio, everything is fine (I use VS 2017 Community)
  • When try with MSBuild (MSBuild /target:rebuild /p:Configuration=Release /m:4), I get this warning "..\WebSite1_1_.metaproj" (Rebuild target) (2) -> ..\WebSite1_1_.metaproj : warning MSB3268: The primary reference "...\WebSite1\DataProvider\bin\Debug\DataProvider.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "...\WebSite1\DataProvider\bin\Debug\DataProvider.dll" or retarget your application to a framework version which contains "System.Runtime, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"."
  • The latest DataProvider dll won't be copied to the Bin folder of "SampleSite", if I use some thing new from DataProvider I will get error (build fail)

I have searched around, including StackOverFlow. But I can't find anything related to my scenario.

I tried:

(no code for this question)

My expectation:

  • I can use MSBuild or something automatically to solve this problem (because this issue is happened on my build server, automatically)



Aucun commentaire:

Enregistrer un commentaire