-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSB4226: The imported project "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/xbuild/Xamarin/Mac/Xamarin.Mac.CSharp.targets" was not found. #9550
Comments
There is no But it does not exists on the preview (or |
The Could this be related to installing mono after Xamarin.Mac? |
I'll double check it but it should be fine since XI has no issue...
No, that was my first thought too (and what I suggested to someone else who hit the issue before). I re-installed XM (and XI) over the mono update and still got the same issue. I'll try nuking both to see if left-overs from upgrades/downgrades could explain it. |
workaround: Nuking mono and XM and then re-installing both works. rm -rf /Library/Frameworks/Mono.framework/
rm -rf /Library/Frameworks/Xamarin.Mac.framework/ So there's something after upgrades/downgrades that can break stable XM. |
We have experienced but not everyone has been effected. We're all on latest XCode 11.6 and latest VSMac (within last week). Only 2 of the 4 of us get this issue. It also effected our cloud builds provided by Bitrise (who may have been in touch directly regarding this issue) |
I got this again after installed Xcode 12 preview (d16-7 based) on top of d16-8. |
In this state
but
|
Thanks @spouliot! Here's the steps I followed to fix it for me on macOS: Uninstall XamarinFollowing the steps from the official Microsoft docs to uninstall Xamarin.iOS, Xamarin.Mac, Xamarin.Android and Visual Studio for Mac
cd ~/Downloads
chmod +x ./uninstall-vsmac.sh
sudo ./uninstall-vsmac.sh
Download/Install Visual Studio for Mac
|
I think this happens because of 2420108, and problems occur when first installing a Xamarin.Mac version with those changes, then downgrading to one without. It seems macOS isn't capable of properly installing a package that replaces a symlink with a directory, and instead ends up writing into where the symlink is pointing to. The broken result is that several files that should be files somehow end up as directories (note how all these *.targets and *.props files are in fact directories): $ ls -la /Library/Frameworks/Xamarin.Mac.framework/Versions/6.20.2.2/lib/msbuild
total 56
drwxr-xr-x 20 rolf wheel 640 Sep 14 14:36 .
drwxr-xr-x 31 rolf wheel 992 Sep 14 14:36 ..
-rw-r--r-- 1 rolf wheel 25112 Jul 19 00:45 FrameworkList.xml
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Localization.MSBuild.dll
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.AppExtension.CSharp.targets
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.AppExtension.Common.props
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.AppExtension.Common.targets
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.CSharp.targets
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.Common.ImplicitFacade.msbuild.targets
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.Common.props
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.Common.targets
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.FSharp.targets
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.ObjCBinding.CSharp.props
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.ObjCBinding.CSharp.targets
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.ObjCBinding.Common.props
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.ObjCBinding.Common.targets
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.TargetFrameworkFix.targets
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.Tasks.dll
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Mac.msbuild.targets
drwxr-xr-x 2 rolf wheel 64 Sep 14 14:36 Xamarin.Shared.targets The workaround is to manually remove sudo rm -Rf /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac and then reinstall the Xamarin.Mac pkg you want to install (there's no need to remove/reinstall Mono). |
I'm running into this too with the Xcode 12 Preview. Update: This seems fixed in the Stable channel today. |
I followed this step but still getting the same error. The directory Xamarin.Mac.CSharp.targets is empty. Is this correct? Thanks. |
@tekmun Did you try this workaround?
|
I tried the workaround, but I am still getting the same error. |
The same issue occurs when building SDK from sources. |
Any updates on this? Thanks! |
@xtmq that particular xamarin-macios hash has the Xamarin.Mac build disabled, because the corresponding Xcode release doesn't ship with an updated macOS SDK. This has recently changed (with Xcode 12.2), so you can use either the |
Ran into this too, and @ToddGrun has just run into this as well. |
I am facing the same issue till I have installed the fresh Visual Studio 2017 and the mac os 10.13.6. /Users/shubhamagrawal/Projects/mloi/mloi.iOS/mloi.iOS.csproj(3,3): Error MSB4019: The imported project "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/xbuild/Xamarin/iOS/Xamarin.iOS.CSharp.targets" was not found. Confirm that the expression in the Import declaration "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/xbuild/Xamarin/iOS/Xamarin.iOS.CSharp.targets" is correct, and that the file exists on disk. (MSB4019) Please help me to resolve the issue. |
@shubhuuu that's a different issue, so please file a new issue so that this doesn't end up too confusing. |
I ran into this and used @rolfbjarne's workaround to unblock me |
For me, the solution was a bit different...
The last step is the crucial one, because by default Visual Studio for Mac (both 2019 & 2022 Preview) install the .NET 5 SDK, which isn't compatible with Xamarin. By following these steps, you will have .NET Core 3.1 installed but not .NET 5, which will allow Visual Studio for Mac > Xamarin projects to build successfully. |
This is a workaround for xamarin/xamarin-macios#9550, which is causing build breaks in the CI validation pipeline...
This is a workaround for xamarin/xamarin-macios#9550, which is causing build breaks in the CI validation pipeline...
Closing, this is not an issue anymore. |
Steps to Reproduce
Expected Behavior
Success
Actual Behavior
This does not seems to happen on d16-8 (or newer) and does not always happen.
I wonder if this only happens when downgrading ?!?
Environment
Build Logs
https://gist.github.com/spouliot/e8092ad8c26b9f322b3a97e68b736a34
Example Project (If Possible)
XM submissions tests can be used.
The text was updated successfully, but these errors were encountered: