Base solution for your next web application
Open Closed

Attempting to build default AgileDemo.Mobile.Droid project in VSTS fails #6191


User avatar
0
smackofham created

We are attempting to set up a CI-CD build for the mobile projects that come with the default ASP.NET Zero AgileDemo project.

At this time, I am able to successfully build the AgileDemo.Mobile.Droid project using an msbuild command on my local using the following command:

msbuild /t:clean;restore;compile;build;packageforandroid AgileDemo.Mobile.Droid.csproj

However, using this same command in a hosted VS2017 MSBuild task in VSTS throws the following errors:

2018-12-21T18:22:21.9051198Z CoreCompile:
2018-12-21T18:22:21.9065316Z   C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csc.exe <snip lots of options>
2018-12-21T18:22:21.9074660Z   Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn
2018-12-21T18:22:22.4124711Z ##[error]aspnet-core\src\AgileDemo.Application.Shared\Authorization\Accounts\Dto\ActivateEmailInput.cs(3,14): Error CS0234: The type or namespace name 'Web' does not exist in the namespace 'System' (are you missing an assembly reference?)
2018-12-21T18:22:22.4132023Z Authorization\Accounts\Dto\ActivateEmailInput.cs(3,14): error CS0234: The type or namespace name 'Web' does not exist in the namespace 'System' (are you missing an assembly reference?) [D:\a\3\s\aspnet-core\src\AgileDemo.Application.Shared\AgileDemo.Application.Shared.csproj]
2018-12-21T18:22:22.4135486Z ##[error]aspnet-core\src\AgileDemo.Application.Shared\Authorization\Accounts\Dto\ResetPasswordInput.cs(3,14): Error CS0234: The type or namespace name 'Web' does not exist in the namespace 'System' (are you missing an assembly reference?)
2018-12-21T18:22:22.4135738Z Authorization\Accounts\Dto\ResetPasswordInput.cs(3,14): error CS0234: The type or namespace name 'Web' does not exist in the namespace 'System' (are you missing an assembly reference?) [D:\a\3\s\aspnet-core\src\AgileDemo.Application.Shared\AgileDemo.Application.Shared.csproj]
<snip>

and on and on.

I'm not sure I understand why it works locally but not on the hosted system running the same version of msbuild.

For fun, I've attempted to build this using a Xamarin task and a dotnet task. All fail as well with similar errors.

Has anyone seen this and resolved it successfully?


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @smackofham

    Do you have System.Web reference in AgileDemo.Application.Shared.csproj ?

  • User Avatar
    0
    smackofham created

    No.

  • User Avatar
    0
    alper created
    Support Team

    MsBuild works differently when there's a Visual Studio installed on a machine. So if you want to have the same behaviour with your development machine, you can try installing Visual Studio on your CI-CD server (this is the result oriented solution).

    alternatively try installing BuildTools on your server https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=BuildTools

  • User Avatar
    0
    alper created
    Support Team

    sorry I missed that you've already installed Visual studio on your server.... am I right you have a Visual Studio on the server?

  • User Avatar
    0
    smackofham created

    Yes - this is a hosted VS2017 build agent. It has Visual Studio 2017 Enterprise installed already.

  • User Avatar
    0
    alper created
    Support Team

    looks like you accidentally added a System.Web reference to AgileDemo.Application.Shared. See these classes whether they have an invalid reference.

    • ActivateEmailInput.cs
    • ResetPasswordInput.cs

    By the way to reproduce the same problem on your dev machine. close visual studio and delete all BIN & OBJ folders. run it again. you'll probably see the same error.