.netvisual-studiowebmsbuildbase-class-library

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


I have 2 projects (.Net 4.0)

The problem:

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:

Update images

If I Right-Click on "WebSite2" -> Build web site, everything will be fine. But I want to use msbuild for automation job


Solution

  • 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:

    enter image description here

    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.