Closed GalaxiaGuy closed 1 year ago
Does the path /Library/Frameworks/Mono.framework/External/xbuild
exist on your system? Does it contain a Xamarin directory?
It does indeed.
I'll try hard-coding that in a moment or two...I'm just seeing if I can 'easily' knock together a Maui version of BLE.Client.Droid.
I end up back with the following error:
/usr/local/share/dotnet/sdk/7.0.305/Microsoft.Common.CurrentVersion.targets(5,5): Error: Project '../../MvvmCross.Plugins.BLE/MvvmCross.Plugins.BLE.csproj' targets 'net6.0-android;net6.0-ios;net6.0-maccatalyst;net7.0-android;net7.0-ios;net7.0-maccatalyst'. It cannot be referenced by a project that targets 'MonoAndroid,Version=v12.0'. (BLE.Client.Droid)
My 'Add base Maui App' is at: https://github.com/IanBUK/dotnet-bluetooth-le
I actually was able to reproduce this yesterday and started working on a fix.
As a temporary work-around, you can probably add symlinks in /usr/share/dotnet/sdk/7.0.xxx
(or whatever version that the upgrade-assistant ends up deciding to use) that point to /Library/Frameworks/Mono.framework/Extensions/xbuild/Novell
and /Library/Frameworks/Mono.framework/Extensions/xbuild/Xamarin
That should hopefully get you further along, but you may run into other macOS port bugs. Let me know how that works out for you.
I’ve got some family and work stuff for the next few days, so I might not be able to try until Saturday, but I’ll see if I can squeeze some them in. Thanks On 8 Jul 2023, at 19:44, Jeffrey Stedfast @.***> wrote: I actually was able to reproduce this yesterday and started working on a fix. As a temporary work-around, you can probably add symlinks in /usr/share/dotnet/sdk/7.0.xxx (or whatever version that the upgrade-assistant ends up deciding to use) that point to /Library/Frameworks/Mono.framework/Extensions/xbuild/Novell and /Library/Frameworks/Mono.framework/Extensions/xbuild/Xamarin That should hopefully get you further along, but you may run into other macOS port bugs. Let me know how that works out for you.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
The symlink helped my upgrade-assistent to run, but the resulting project was not usable. I also ran into some other issue when running upgrade assistant: #1500
cd /usr/local/share/dotnet/sdk/7.0.305/
sudo ln -s /Library/Frameworks/Mono.framework/External/xbuild/Xamarin .
Looks like the new upgrade assistant code-base (which is not located in this repo) is going to take a while to port to macOS. It's not going to be as trivial as I had hoped (i.e. just fixing things to be able to locate the Xamarin.iOS/Android/etc targets files).
I would recommend trying to use the tool from Windows for the time being until I can figure out how to port the new code-base to macOS.
@jstedfast Thanks, good to know that they are not the same. I will give it a try on Windows.
It looks like at least some of the problems are caused by the mvvm framework being used.
I’m going to try, on Saturday, putting together a simple Maui app without the mvvm framework, using some simpler binding - in an attempt to rule this out.
So, I've got a new commit in https://github.com/IanBUK/dotnet-bluetooth-le.git
This adds a simple Maui app to the solution. I've got to the point where an app framework is in place and you can press the "Scan" button. It then fails with a permissions test on Android, which hopefully shouldn't take too long to fix.
However, it's referencing BLE.Plugin quite happily, compiling and running.
So, that's a start.
Looks like the new upgrade assistant code-base (which is not located in this repo) is going to take a while to port to macOS. It's not going to be as trivial as I had hoped (i.e. just fixing things to be able to locate the Xamarin.iOS/Android/etc targets files).
I would recommend trying to use the tool from Windows for the time being until I can figure out how to port the new code-base to macOS.
Hey there, and thanks for all the work on the upgrade assistant. I managed to make it go when adding the symlink to the Xamarin directory.
Unfortunately, I couldn't run it using --no-interaction as it stated "Invalid project path". After running it with interactions, I first migrated the Android, then the IOS project (in-place).
Now working on "Invalid restore input. Duplicate frameworks found: 'xamarinios10, xamarinios10' issue.
@EeKay,
Weird, you got further than I've gotten. The symlink hack that I had suggested in an earlier comment got the build to be able to find the Xamarin.[Android,iOS].CSharp.targets
files, but then it couldn't locate the Xamarin.iOS v1.0 or MonoANdroid v11.0 frameworks, so I had to modify my *.csproj
files by adding <TargetFrameworkRootPath>/Library/Frameworks/Mono.framwework/External/xbuild-frameworks</TargetFrameworkRootPath>
. Once I did that, I was able to build.
I've got a local patch that fixes the upgrade-assistant to create the proper symlinks for users (I did this in the 0.4.x version of the upgrade-assistant but when the logic got copied over to the 0.5 version, something broke and needed some tweaking), but I've been struggling to get the TargetFrameworkRootPath
hack to work when loading projects in the upgrade-assistant.
So that's where I'm at right now...
@jstedfast perhaps it had something to do with my project setup? Although the core wasn't that weird: Xamarin.Forms project with a shared project, and both an iOS and Android target.. some nugets that all got upgraded properly.
Working on two things now:
Issue 1. double frameworks I've been looking into the xamarinios10, xamarinios10 issue. The literal compile error was:
Invalid restore input. Duplicate frameworks found: 'xamarinios10, xamarinios10'. Input files: /mydirs/Projectname/Projectname.iOS/Projectname iOS.csproj.
I was checking the .csproj files, and all I can find is that BOTH the iOS and Android csproj state the following targetframeworks:
<TargetFrameworks>net7.0-android;net7.0-ios</TargetFrameworks>
I reckon that I need to change this to "net7.0-android; for the Android, and the ios variant for the ios project (this might have happened because I "upgraded the android and then ios project separately" using the interactive mode?
Issue 2. cannot set ios starter project Perhaps because I upgraded both projects in the interactive mode one after eachother, but I cannot select the Myproject.iOS project as startup project. I CAN do this for the Android version.
Same with selecting the "debug" or "debug|iphone" target; it doesn't select/activate the proper platform project anymore like it did with Xamarin.Forms...
I've got this working now for macOS. Should be released in another 2 weeks or so when the next release happens.
upgrade-assistant.clef
that is produced in the working directoryI could not find a file
upgrade-assistant.clef
.Describe the bug
When trying to run the CLI tool on any iOS or Android project, I get an error that the
.CSharp.targets
file cannot be found.Exceptions (if any)
Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/usr/local/share/dotnet/sdk/7.0.202/Xamarin/iOS/Xamarin.iOS.CSharp.targets" was not found. Confirm that the expression in the Import declaration "/usr/local/share/dotnet/sdk/7.0.202/Xamarin/iOS/Xamarin.iOS.CSharp.targets" is correct, and that the file exists on disk.
Full stack trace:
``` Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/usr/local/share/dotnet/sdk/7.0.202/Xamarin/iOS/Xamarin.iOS.CSharp.targets" was not found. Confirm that the expression in the Import declaration "/usr/local/share/dotnet/sdk/7.0.202/Xamarin/iOS/Xamarin.iOS.CSharp.targets" is correct, and that the file exists on disk. /Users/obbbrown/Documents/Repos/MobileAppsGit/Apps/TotalPlatformCommon.iOS/TotalPlatformCommon.iOS.csproj at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args) at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1,T2](IElementLocation elementLocation, String resourceName, T1 arg0, T2 arg1) at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpression(String directoryOfImportingFile, ProjectImportElement importElement, String unescapedExpression, Boolean throwOnFileNotExistsError, List`1& imports) at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, SdkResult& sdkResult) at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult) at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator`4.Evaluate() at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive) at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory) at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion) at Microsoft.UpgradeAssistant.Services.DefaultMsbuildProjectAccess..ctor(String projectPath, ILogger logger, CancellationToken cancellationToken) at Microsoft.UpgradeAssistant.Cli.Slices.Services.Msbuild.MsbuildService.GetProjectAccessAsync(String projectPath, Boolean isReadOnly, ILogger logger, CancellationToken cancellationToken) at Microsoft.UpgradeAssistant.Cli.Slices.Services.Project.MsbuildProjectBuilder.BuildAsync(ISolution solution, String projectPath, CancellationToken cancellationToken) at Microsoft.UpgradeAssistant.Cli.Slices.Services.Project.ProjectService.GetProjectAsync(ISolution solution, String projectPath, CancellationToken cancellationToken) at Microsoft.UpgradeAssistant.Cli.Slices.Services.Project.ProjectService.GetProjectByPathAsync(ISolution solution, String projectPath, ILogger logger, CancellationToken cancellationToken) at UpgradeHost.GetTraitsAsync(String projectPath, CancellationToken cancellationToken) at Spectre.Console.Flow.FlowContextExtensions.GetOriginalTraitsAsync(IFlowContext context, String projectPath, IUpgradeHost host, CancellationToken cancellationToken) at Microsoft.UpgradeAssistant.Cli.Flow.Steps.Upgrade.SelectControllerFlowStep.<>c__DisplayClass8_0.<Further technical details
dotnet --list-sdks