Xamarin.Swift icon indicating copy to clipboard operation
Xamarin.Swift copied to clipboard

msbuild command line build does not add SwiftSupport folder

Open caldrian opened this issue 5 years ago • 5 comments

Thank you for creating and sharing this project, it has been of great value to me and my team!

Up to now I have been archiving my builds manually through Visual Studio for Mac and everything works great.

From now on, however, I would like to build from the command line, but I noticed that the build targets that you created (_SwiftFrameworksMac, _SwiftSupportIPA, _SwiftSupportArchive) don't seem to be executed with msbuild. At least i don't see them in the output of msbuild and the created ipa does not include the SwiftSupport folder.

msbuild MyProject.sln \
/p:Configuration="Release" \
/p:Platform="iPhone" \
/p:BuildIpa="true" \
/p:ArchiveOnBuild="true" \
/t:Clean,Build

Maybe I'm just missing something here, can you give me a hint, please?

caldrian avatar Aug 17 '19 06:08 caldrian

I'm having the same issue on Swift4 Library

volcano619 avatar Aug 30 '19 07:08 volcano619

@caldrian @volcano619 are you still having this issue?

Flash3001 avatar Apr 15 '20 19:04 Flash3001

Hi Lucas,

I still have the same issue. Maybe it's just the wrong command I use to build the app. I created a simple project where the issue can be reproduced: (see the Makefile) SomeApp.zip

When I build the app in Visual Studio the output shows following lines and everything works:

Target _SwiftSupportIPA:
    Looking for Swift version on: bin/iPhone/Release/SomeApp.app/Frameworks/SomeFramework.framework/SomeFramework
    Expected Swift header on: bin/iPhone/Release/SomeApp.app/Frameworks/SomeFramework.framework/Headers/SomeFramework-Swift.h
    bin/iPhone/Release/SomeApp.app/Frameworks/SomeFramework.framework/Headers/SomeFramework-Swift.h exists.
    Including Swift dylibs because you are targeting an OS version that doesnt include it.
    Installed: 5.2.2
    SomeFramework Framework: 5.2.2
    mkdir -p 'obj/iPhone/Release/ipa/SwiftSupport'; mkdir -p 'obj/iPhone/Release/ipa/SwiftSupport/iphoneos'; ls -1 'bin/iPhone/Release/SomeApp.app/Frameworks' | grep libswift | while read dylib; do '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo' "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos/$dylib"  -remove armv7s -remove arm64e -output "obj/iPhone/Release/ipa/SwiftSupport/iphoneos/$dylib";done
Target _ZipIpa:
...

However, when I build on the command line using

msbuild "./Xamarin/SomeApp.sln" \
	/p:Configuration="Release" \
	/p:Platform="iPhone" \
	/p:IpaPackageDir="./bin/iPhone/Release" \
	/t:Clean,Build

there is no output like above. To further verify that something is incorrect I submitted the both created .ipa files to TestFlight. The VisualStudio build works as expected, but the command line built app crashes on start-up.

Do you have any clue what mistake I am making?

Thank you very much! @Flash3001

caldrian avatar Apr 16 '20 14:04 caldrian

Running the same command works on my projects. Are you your running the command on the same machine as your Visual Studio for Mac is running?

If nothing works you can use the following script https://github.com/Flash3001/ipa-packager/blob/master/package_ipa_default.sh to include the SwiftSupport folder on the IPA.

Flash3001 avatar Apr 29 '20 20:04 Flash3001

yes, on the same machine. okay, that will do as a workaround, thanks a lot!

caldrian avatar Apr 29 '20 20:04 caldrian