Method not found: 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object)

前端 未结 6 1763
孤独总比滥情好
孤独总比滥情好 2021-01-03 20:42

I have a Web API 2 project with help pages that runs fine locally but throws this error when I push it to Azure:

Method not found: \'System.String Sys

6条回答
  •  我在风中等你
    2021-01-03 21:19

    We are using custom build server. Even if project TargetFrameworkVersion is v4.5.1, when .net 4.6.1 installed to build server and single argument passed as format argument, the compiler prefers to use this overload

    public static string Format(IFormatProvider provider, string format, object arg0)
    

    instead of

    public static string Format(IFormatProvider provider, string format, params object[] args)
    

    Only solution is creating and passing array argument

    Example:

    string.Format(CultureInfo.CurrentCulture, "Hello {0}", new[] { name });

提交回复
热议问题