VSTS Hosted Build .Net Framework 4.6.2

試著忘記壹切 提交于 2019-12-04 17:25:58

问题


I'm getting errors during VSTS build process stating .net 4.6.2 is not found. Any idea when it will be made available on the build agents?

2016-08-30T17:09:31.0009946Z ##[error]C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1098,5): Error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.


回答1:


Download the correct DEVELOPER targetting pack from here:

https://www.microsoft.com/net/targeting




回答2:


First of all, be sure that the .NET framework are you using is listed here: Targeting .NET Platforms (I don't understand why 4.6.1 is not listed and 4.6.2 is listed.).

To resolve the issue about that the .Net Framework is not found, use Nuget 3.5.0 RC2. It solved the issue for me.




回答3:


Based on my test, I can reproduce that issue with Hosted Build. Net Framework 4.6.2 isn’t available on Hosted Build now.

You can refer to this thread https://social.msdn.microsoft.com/Forums/en-US/f62a8156-d6a0-4a16-848e-ac426b3656a9/hosted-agent-support-for-net-framework-462?forum=TFService and vote this user voice https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/15691884-add-net-4-6-2-on-vsts-hosted-agent

The workaround is that you could setup a new build server on your machine with .Net Framework 4.6.2 be installed.




回答4:


just add this line to Build solution -> MSBuild Arguments

/p:TargetFrameworkVersion=v4.6.2




回答5:


Add below to web.config or mentioned by hirigoshy use targetframework property as part of build process.

<compilation debug="true" targetFramework="4.6.2"/>



回答6:


I experienced this issue when i was using a default Host as Agent- instead use a agent with dotNet Framework support. (e.g Hosted VS2017)



来源:https://stackoverflow.com/questions/39233487/vsts-hosted-build-net-framework-4-6-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!