locked
Azure Function Project won't compile with TFS build agent Error MSB4066: The attribute "Version" in element <PackageReference> is unrecognized. RRS feed

  • Pytanie

  • The Function project builds and works fine in VS2017 15.4.0 both on my dev machine and interactively on our build server. When we run a build through the build agent, it fails with a couple of messages:

    Error MSB4066: The attribute "Version" in element <PackageReference> is unrecognized.

    Error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.

    The second error is an easy fix by adding the suggested namespace. Not so much for the first one.

    I found this post which suggests that setting up a second pool that is not the Default will fix this. Honestly, it was a huge pain to set up the first one with security tokens, etc., so I don't want to spend a lot of time on that if I can avoid it.

    The post alludes to it being related to missing Targets on the default instance (whatever that means) and that they can be imported and run on the default agent.

    I've seen other posts saying this is also a problem on VSTS, but we're not using that and the work-arounds don't seem to fit.

    HELP!

    Mike


    Mike Yeager

    środa, 18 października 2017 19:43

Wszystkie odpowiedzi

  • Hi,

    is the latest version of MSBuild installed on the build server and set in the environment variables to look in the VS2017 folder for that MSBuild version?


    C# MVP (2007-2010). MVP Reconnect. MS Vendor - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator


    • Zmodyfikowany przez ahmedilyas środa, 29 listopada 2017 09:46
    środa, 29 listopada 2017 09:31
  • We are running into the same issue from VSTS build. 

    Error MSB4066: The attribute "Version" in element <PackageReference> is unrecognized.

    środa, 29 listopada 2017 16:26
  • I am also getting the same error for function apps. I am pointing the MSBuild version in the build. Still it shows the error. Please let me know how to fix the problem. 
    środa, 24 stycznia 2018 07:21
  • Rav_nan - did you read my response? Did you check to see if the environment variables are pointing to the correct path for the latest MSBuild?

    C# MVP (2007-2010) MS Vendor - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator

    środa, 24 stycznia 2018 07:23
  • hi, 

    I am also having the same issue..

    The attribute "Version" in element <PackageReference> is unrecognized.

    any one got the solution please replay me..



    • Zmodyfikowany przez Siva Bhavani środa, 4 kwietnia 2018 09:35
    środa, 4 kwietnia 2018 09:31
  • Siva, are you using Azure Functions V1 or V2 (i.e. are you running against .NET Core or .NET standard)?
    środa, 4 kwietnia 2018 19:09