使用 msbuild 从命令行构建 Xamarin.Forms iOS 项目
Building Xamarin.Forms iOS project from command line with msbuild
我正在尝试通过命令行直接在 macOS 上构建一个 Xamarin.Forms iOS 项目用于 CI/CD 目的:
msbuild C4S_MobileApp.iOS/C4S_MobileApp.iOS.csproj /restore /p:Platform=iPhone /p:ArchiveOnBuild=true /p:Configuration="Release" /p:BuildProjectReferences="false"
问题是共享应用程序项目,我避免使用 /p:BuildProjectReferences="false"
重建它并且找不到其 .dll:
CSC : error CS0006: Metadata file '/Users/c4s/Projects/c4s_refactored/c4s-refactored-mobile-app/C4S_MobileApp/bin/iPhone/Release/netstandard2.1/C4S.MobileApp.dll' could not be found [/Users/c4s/Projects/c4s_refactored/c4s-refactored-mobile-app/C4S_MobileApp.iOS/C4S_MobileApp.iOS.csproj]
MSBuild 假定 .dll 在 C4S_MobileApp/bin/iPhone/Release/netstandard2.1/
中,但它在 C4S_MobileApp/bin/Release/netstandard2.1
中。一个丑陋的解决方案是将 C4S.MobileApp.dll 复制到该位置。没有 /p:BuildProjectReferences="false"
的构建是有效的,因为 msbuild 然后创建 C4S_MobileApp/bin/iPhone/Release/netstandard2.1/C4S.MobileApp.dll
我在 msbuild 命令中添加了参数 /p:AssemblySearchPaths="C4S_MobileApp/bin/Release/netstandard2.1"
并且还在 Release|iPhone 配置下的 C4S_MobileApp.iOS.csproj 文件中添加了 <AssemblySearchPaths>C4S_MobileApp/bin/Release/netstandard2.1;$(AssemblySearchPaths)</AssemblySearchPaths>
但它似乎被 msbuild 忽略了.
文件夹结构:
c4s-refactored-mobile-app/
-> C4S_MobileApp/
-> C4S_MobileApp.iOS/
感谢您的帮助和建议。
不幸的是,这是 Xamarin.iOS 中的错误:https://github.com/xamarin/xamarin-macios/issues/10308
我正在尝试通过命令行直接在 macOS 上构建一个 Xamarin.Forms iOS 项目用于 CI/CD 目的:
msbuild C4S_MobileApp.iOS/C4S_MobileApp.iOS.csproj /restore /p:Platform=iPhone /p:ArchiveOnBuild=true /p:Configuration="Release" /p:BuildProjectReferences="false"
问题是共享应用程序项目,我避免使用 /p:BuildProjectReferences="false"
重建它并且找不到其 .dll:
CSC : error CS0006: Metadata file '/Users/c4s/Projects/c4s_refactored/c4s-refactored-mobile-app/C4S_MobileApp/bin/iPhone/Release/netstandard2.1/C4S.MobileApp.dll' could not be found [/Users/c4s/Projects/c4s_refactored/c4s-refactored-mobile-app/C4S_MobileApp.iOS/C4S_MobileApp.iOS.csproj]
MSBuild 假定 .dll 在 C4S_MobileApp/bin/iPhone/Release/netstandard2.1/
中,但它在 C4S_MobileApp/bin/Release/netstandard2.1
中。一个丑陋的解决方案是将 C4S.MobileApp.dll 复制到该位置。没有 /p:BuildProjectReferences="false"
的构建是有效的,因为 msbuild 然后创建 C4S_MobileApp/bin/iPhone/Release/netstandard2.1/C4S.MobileApp.dll
我在 msbuild 命令中添加了参数 /p:AssemblySearchPaths="C4S_MobileApp/bin/Release/netstandard2.1"
并且还在 Release|iPhone 配置下的 C4S_MobileApp.iOS.csproj 文件中添加了 <AssemblySearchPaths>C4S_MobileApp/bin/Release/netstandard2.1;$(AssemblySearchPaths)</AssemblySearchPaths>
但它似乎被 msbuild 忽略了.
文件夹结构:
c4s-refactored-mobile-app/
-> C4S_MobileApp/
-> C4S_MobileApp.iOS/
感谢您的帮助和建议。
不幸的是,这是 Xamarin.iOS 中的错误:https://github.com/xamarin/xamarin-macios/issues/10308