The type 'HttpRequestMessage' is defined i

2019-08-21 10:10发布

When i build locally it works, but my VSTS hosted 2017 instance build fails with the following message:

[error]apps\Ascend.Identity\AccountController.cs(126,17): Error CS0012: The type 'HttpRequestMessage' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Locally, there is also a yellow triangle in the reference list. enter image description here

but it still builds

and the reference is there in csproj

enter image description here

and the package is restored from nuget (packages.config)

 <package id="System.Net.Http" version="4.3.3" targetFramework="net472" />

1条回答
淡お忘
2楼-- · 2019-08-21 10:44

In your local, try the steps below:

  1. Delete packages folder in your source directory.
  2. Remove System.Net.Http reference.
  3. Right click References, select Manage Nuget Packages, browser and install package System.Net.Http.
  4. Build your project and check the result. Make sure there is no yellow triangle in the reference list.
  5. Check in the changes and queue a build.
查看更多
登录 后发表回答