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)
Update images
- Solution

- Just added new property to DataProvider:

- Use it normally on Website:

- MSBuild output:

- DataProvider project:

If I Right-Click on "WebSite2" -> Build web site, everything will be fine. But I want to use msbuild for automation job
I can now reproduce same issue in my machine(details see #4594), since it has some difference from #5993, I report it in msbuild
instead of dotnet cli
. Issue reported to Msbuild 4594.
And a workaround which can work in command-line is to use devenv commands.
But it requires us to install VS in build machine, then we can use devenv command
like:

Use the -Rebuild
switch can works well like what it behaves in VS. See Remark1.
In my opinion, if we build this specific solution in vs, it may make more actions behind than single msbuild.exe does. And that's why it works well in vs but not msbuild command-line.
So if we need to automatically build this particular website in build server, we can try to use devenv command.(To see build output,it seems using devenv.com
is better than using devenv.exe
, see this)
Hope it makes some help and let's track the issue in 4594.