当我尝试使用dotnet构建我的.csproj文件时,它会抛出错误,但是当我在Visual Studio 2019中构建项目时,它成功了。我需要使用dotnet进行构建,因为我的Azure管道作业需要它。这是错误信息:
(也可以查看截图。)
如果我将
然后错误发生了变化:
有没有解决这个问题的建议?
dotnet build MyProject.Mobile.Droid.csproj --configuration Release --force
MyProject.Mobile.Droid.csproj(584,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.1.100\\Xamarin\Android\Xamarin.Android.CSharp.targets was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\3.1.100\\Xamarin\Android\Xamarin.Android.CSharp.targets" is correct, and the file exists on disk.
Build FAILED.
(也可以查看截图。)
如果我将
.csproj
中的路径参数设置为以下内容:<MSBuildExtensionsPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild</MSBuildExtensionsPath>
然后错误发生了变化:
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
有没有解决这个问题的建议?
dotnet build -clp:ErrorsOnly -p:MSBuildExtensionsPath="/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/Current/bin" -p:TargetFrameworkRootPath="/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks
,但我还没有测试过。 - user1623521