xamarin-macios
xamarin-macios copied to clipboard
Setting AppBundleDir to a custom value results in error MSB4044: The "SpotlightIndexer" task was not given a value for the required parameter "Input".
Repro: https://gist.github.com/rolfbjarne/68af146bb629e732e32e47125e7eb818
Result:
error MSB4044: The "SpotlightIndexer" task was not given a value for the required parameter "Input".
Binlog: build-2022-05-12-175855.binlog.zip
This is most likely the problem:
https://github.com/xamarin/xamarin-macios/blob/06041ab37f153c4e14f0e4a6036e8062a6d72d74/msbuild/Xamarin.Shared/Xamarin.Shared.targets#L2648-L2652
we don't set _AppContainerDir
when AppBundleDir
is set.
Workaround: set _AppContainerDir
yourself. This should be the parent directory of AppBundleDir
.
<PropertyGroup>
<_AppContainerDir>$([System.IO.Path]::GetDirectoryName($(AppBundleDir)))</_AppContainerDir>
</PropertyGroup>
The fix should be fairly simple: compute _AppContainerDir
even if AppBundleDir
is set.
Yup, this workaround fixed it, thanks!
This is what I get with the workaround added: Am I missing something?
error: cannot parse the debug map for '/dir/remove/for-public-post/$([System.IO.Path]::GetDirectoryName($(AppBundleDir)).app/AppName': No such file or directory
@jtorvald looks like there's a missing parenthesis at the end, try this:
<PropertyGroup>
<_AppContainerDir>$([System.IO.Path]::GetDirectoryName($(AppBundleDir)))/</_AppContainerDir>
</PropertyGroup>
Thanks @rolfbjarne, the error parse error goes away, but still have the:
error MSB4044: The "SpotlightIndexer" task was not given a value for the required parameter "Input".
does that property need to be in the .csproj? Or in the .targets? I've it in the .csproj outside of the device condition but also tried within the one for Debug|iPhone for example and I keep getting this spotlight error.
@jtorvald can you create a binlog as described here and upload it: https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#build-logs?
@rolfbjarne thanks for your reply. I will investigate it again next month and try to cleanup the project file. It's an old project (2012) with many updates, upgrades and other patch fixes for problems. Maybe it's good to set it up from scratch and try again.
@rolfbjarne can it be because there is no trailing slash at the end of the OutputPath
?
I finally managed to get it compile and distribute again with adding this to the specific build configuration:
<AppBundleName>MyAppName</AppBundleName>
<AppBundleDir>$(OutputPath)/$(AppBundleName).app</AppBundleDir>
<_AppContainerDir>$([System.IO.Path]::GetDirectoryName($(AppBundleDir)))/</_AppContainerDir>
During debugging and trying different things I noticed that the build failed because somewhere in the debug output there was the directory bin/iPhone/DebugAppName.app. When I added a trailing slash in the _AppContainerDir it fixed the issue. Then I realized it was maybe the contents of the OutputPath that caused the issue.
When I remove the three properties and added a trailing slash to the OutputPath: <OutputPath>bin\iPhone\Debug\</OutputPath>
the build works.
So I get the feeling that there is some path-parts being glued without a separator.
Ah yes, _AppContainerDir
is supposed to have a trailing separator. I've updated the workaround.