简体   繁体   中英

dotnet build xamarin project fails using console

when i try to build my .csproj file with dotnet it throws to me an error, but when i build project at visual sutido 2019 its ok.

I need to build with dotnet because azurepiple job use it.

error

after, when i set path param in my .csproj to these:

<MSBuildExtensionsPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild</MSBuildExtensionsPath>

errors change:

The reference assemblies for MonoAndroid,Version=v1.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks

Any suggestions to solve it?

You'll need to use msbuild (like msbuild MySolution.sln ) to build a Xamarin project today.

You can build the individual netstandard2.x projects using dotnet build , however the Mono based platform projects (ie the Android and iOS projects) need to be built using msbuild .

Try setting the TargetFrameworkRootPath to where you have xamarin installed.

<TargetFrameworkRootPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\</TargetFrameworkRootPath>

or on the command line

dotnet build -clp:ErrorsOnly -p:MSBuildExtensionsPath="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild"/ -p:TargetFrameworkRootPath="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/ReferenceAssemblies/Microsoft/Framework/"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM