4

I am trying to build a Xamarin project with Refit 6.0 via the command line.

I tried to compile the .Net Standard project with dotnet build and the Xamarin.Android project with msbuild.

dotnet build demo/demo.csproj 
msbuild /t:Build demo.Android/demo.Android.csproj 

I get the following error message in the xamarin android build.

/Users/ci/.nuget/packages/refit/6.0.24/buildTransitive/netstandard2.0/refit.targets(19,5): 
error : Projects using Refit cannot build using MSBuild '16.6.0'. MSBuild '16.8.0' or later is required. [/Users/ci/work/tmp/demo/demo.Android/demo.Android.csproj]
Done Building Project "/Users/ci/source/demo/demo.Android/demo.Android.csproj" (Build target(s)) -- FAILED.

Build FAILED.

"/Users/ci/source/demo/demo.Android/demo.Android.csproj" (Build target) (1) ->
(_RefitMSBuildVersionCheck target) -> 
  /Users/ci/.nuget/packages/refit/6.0.24/buildTransitive/netstandard2.0/refit.targets(19,5): error : Projects using Refit cannot build using MSBuild '16.6.0'. MSBuild '16.8.0' or later is required. [/Users/ci/source/demo/demo.Android/demo.Android.csproj]

    0 Warning(s)
    1 Error(s)

Docs excerpt:

"SDK Requirements Refit 6 requires at Visual Studio 16.8 or higher, or the .NET SDK 5.0.100 or higher. It can target any .NET Standard 2.0 platform." source: https://github.com/reactiveui/refit#sdk-requirements

What is the correct command line command to build an APK and IPA?

Update 1:

I have found a workaround for the problem. https://github.com/microsoft/appcenter/issues/2120#issuecomment-798798890

I image it would just require an environment variable / symbolic link change for msbuild. For example, point msbuild to mono /Applications/Visual\ studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/MSBuild.dll instead of using the current default msbuild.

Martin Ryan
  • 61
  • 1
  • 5
  • It is right there in the [docs](https://github.com/reactiveui/refit#sdk-requirements) as you quoted: `Refit 6 requires at Visual Studio 16.8 or higher`. That is not a thing of the "right command line" (arguments). You need to update your Visual Studio 2019 16.6 to Visual Studio 2019 16.8 or newer. When you do this, you'll have MSBuild 16.8 (or newer) as well. – Christian.K Mar 04 '21 at 15:26
  • 3
    They are using a mac. MacOS unfortunately _still_ doesn't have MSBuild 16.8 :-( Tracked here: https://github.com/mono/mono/issues/20250 – Cheesebaron Mar 04 '21 at 15:31
  • Thanks for the link to the mono issue. Let's hope we get an update soon. – Martin Ryan Mar 30 '21 at 09:45
  • 1
    Downgrading Refit package to 5.2.4 and removing obj and bin folder did get me going for now. – Raphael Soares Sep 30 '21 at 18:39

0 Answers0