jbowmanp1107 / ImageCropper.Maui

MIT License
43 stars 10 forks source link

The type or namespace name 'Bind_TOCropViewController' could not be found #24

Open fatscally opened 2 weeks ago

fatscally commented 2 weeks ago

Hi Jeff. Nice to "meet" you. I started a new thread to keep things tidy. I'd like to contribute but can't get the source built. And I'm new to the Nuget creation world. I have the Nuget installed and running in my (android) app and it's good but I'd like to add a few extra variables.

I downloaded all of the code clean again and I got rid of most of the errors.
I am still getting this weird one though. It is saying the Bind_TOCropViewController isn't there, when clearly it is. I added references etc but that only made more errors. Of course I did 100 Build-Clean-Rebuild, deleted bin - obj etc.

(In the meantime I'll give it another clean download to concentrate on the steps I'm taking)

image

Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.9.6

fatscally commented 2 weeks ago

I did a clean install and it automagically restored all Nugets. I ran Rebuild All. Here is the output: 4 succeeded, 1 failed (I deleted lots of unnecessary lines from the successful builds.)

Rebuild started at 10:44... Restored C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Kotlin.Parcelize.Runtime.Maui\Kotlin.Parcelize.Runtime.Maui.csproj (in 10 ms). Restored C:\Users\mrray\Source\Repos\ImageCropper.Maui3\TOCropView.Maui\TOCropView.Maui.csproj (in 47 ms). Restored C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Kotlin.Android.Extensions.Runtime.Maui\Kotlin.Android.Extensions.Runtime.Maui.csproj (in 50 ms). Restored C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Com.Vannikteck.AndroidImageCropper.Maui\Com.Vanniktech.AndroidImageCropper.Maui.csproj (in 64 ms). 1>------ Rebuild All started: Project: TOCropView.Maui, Configuration: Debug Any CPU ------ 2>------ Rebuild All started: Project: Kotlin.Android.Extensions.Runtime.Maui, Configuration: Debug Any CPU ------ Restored C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\ImageCropper.Maui.csproj (in 147 ms). 1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7129\tools\msbuild\iOS\Xamarin.Shared.targets(1639,3): warning : It's currently not supported to build a binding project from Windows unless a connection to a Mac is available. 1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.2.8004\tools\msbuild\iOS\Xamarin.Shared.targets(1723,3): warning : It's currently not supported to build a binding project from Windows unless a connection to a Mac is available. 1>TOCropView.Maui -> C:\Users\mrray\Source\Repos\ImageCropper.Maui3\TOCropView.Maui\bin\Debug\net7.0-ios\TOCropView.Maui.dll 1>Done building project "TOCropView.Maui.csproj". 1>TOCropView.Maui -> C:\Users\mrray\Source\Repos\ImageCropper.Maui3\TOCropView.Maui\bin\Debug\net8.0-ios\TOCropView.Maui.dll 2>obj\Debug\net8.0-android\api.xml.class-parse : warning BG8605: The Java type '$' could not be found (are you missing a Java reference jar/aar or a Java binding library NuGet?) 2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\tools\Xamarin.Android.Bindings.ClassParse.targets(43,5): obj\Debug\net8.0-android\api.xml.class-parse warning BG8605: The Java type '$' could not be found (are you missing a Java reference jar/aar or a Java binding library NuGet?) LINES CROPPED OUT 2>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Kotlin.Android.Extensions.Runtime.Maui\obj\Debug\net7.0-android\generated\src\Kotlinx.Android.Extensions.IContainerOptions.cs(190,25,190,33): warning CS0114: 'IContainerOptionsInvoker.ToString()' hides inherited member 'Object.ToString()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. 2>Kotlin.Android.Extensions.Runtime.Maui -> C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Kotlin.Android.Extensions.Runtime.Maui\bin\Debug\net8.0-android\Kotlin.Android.Extensions.Runtime.Maui.dll 2>Kotlin.Android.Extensions.Runtime.Maui -> C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Kotlin.Android.Extensions.Runtime.Maui\bin\Debug\net7.0-android\Kotlin.Android.Extensions.Runtime.Maui.dll 2>Done building project "Kotlin.Android.Extensions.Runtime.Maui.csproj". 2>The package Kotlin.Android.Extensions.Runtime.Maui.1.7.20.5 is missing a readme. Go to https://aka.ms/nuget/authoring-best-practices/readme to learn why package readmes are important. 2>Successfully created package 'C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Kotlin.Android.Extensions.Runtime.Maui\bin\Debug\Kotlin.Android.Extensions.Runtime.Maui.1.7.20.5.nupkg'. 3>------ Rebuild All started: Project: Kotlin.Parcelize.Runtime.Maui, Configuration: Debug Any CPU ------ 3>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Kotlin.Parcelize.Runtime.Maui\obj\Debug\net8.0-android\generated\src\Kotlinx.Parcelize.IWriteWith.cs(112,22,112,28): warning CS0114: 'IWriteWithInvoker.Equals(Object?)' hides inherited member 'Object.Equals(Object?)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. LINES CROPPED OUT 3>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Kotlin.Parcelize.Runtime.Maui\obj\Debug\net7.0-android\generated\src\Kotlinx.Parcelize.ITypeParceler.cs(194,26,194,34): warning CS0114: 'ITypeParceler.IContainerInvoker.ToString()' hides inherited member 'Object.ToString()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. 3>Kotlin.Parcelize.Runtime.Maui -> C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Kotlin.Parcelize.Runtime.Maui\bin\Debug\net7.0-android\Kotlin.Parcelize.Runtime.Maui.dll 3>Done building project "Kotlin.Parcelize.Runtime.Maui.csproj". 3>The package Kotlin.Parcelize.Runtime.Maui.1.7.20.5 is missing a readme. Go to https://aka.ms/nuget/authoring-best-practices/readme to learn why package readmes are important. 3>Successfully created package 'C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Kotlin.Parcelize.Runtime.Maui\bin\Debug\Kotlin.Parcelize.Runtime.Maui.1.7.20.5.nupkg'. 4>------ Rebuild All started: Project: Com.Vanniktech.AndroidImageCropper.Maui, Configuration: Debug Any CPU ------ 4>obj\Debug\net8.0-android\api.xml.class-parse : warning BG8605: The Java type '$' could not be found (are you missing a Java reference jar/aar or a Java binding library NuGet?) 4>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\tools\Xamarin.Android.Bindings.ClassParse.targets(43,5): obj\Debug\net8.0-android\api.xml.class-parse warning BG8605: The Java type '$' could not be found (are you missing a Java reference jar/aar or a Java binding library NuGet?) LINES CROPPED OUT 4>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.52\tools\Xamarin.Android.Bindings.Core.targets(92,5): obj\Debug\net8.0-android\api.xml(3403,8) warning BG8401: Skipping 'Com.Canhub.Cropper.CropImageOptions.Creator' due to a duplicate nested type name. (Java type: 'com.canhub.cropper.CropImageOptions') 4>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Com.Vannikteck.AndroidImageCropper.Maui\obj\Debug\net8.0-android\generated\src\Com.Canhub.Cropper.CropException.cs(28,35,28,43): warning CS0108: 'CropException.Cancellation._members' hides inherited member 'CropException._members'. Use the new keyword if hiding was intended. LINES CROPPED OUT 4>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Com.Vannikteck.AndroidImageCropper.Maui\Additions\CropImageActivityBinding.cs(20,47,20,78): warning CS8604: Possible null reference argument for parameter 'input' in 'Intent CropImageContract.CreateIntent(Context context, CropImageContractOptions input)'. 4>Com.Vanniktech.AndroidImageCropper.Maui -> C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Com.Vannikteck.AndroidImageCropper.Maui\bin\Debug\net8.0-android\Com.Vanniktech.AndroidImageCropper.Maui.dll 4>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.95\tools\Xamarin.Android.Bindings.ClassParse.targets(43,5): obj\Debug\net7.0-android\api.xml.class-parse warning BG8605: The Java type '$' could not be found (are you missing a Java reference jar/aar or a Java binding library NuGet?) 4>obj\Debug\net7.0-android\java-resolution-report.log : warning BG8606: Some types or members could not be bound because referenced Java types could not be found. See the 'java-resolution-report.log' file for details. LINES CROPPED OUT 4>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Com.Vannikteck.AndroidImageCropper.Maui\Additions\CropImageActivityBinding.cs(20,47,20,78): warning CS8600: Converting null literal or possible null value to non-nullable type. 4>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Com.Vannikteck.AndroidImageCropper.Maui\Additions\CropImageActivityBinding.cs(20,47,20,78): warning CS8604: Possible null reference argument for parameter 'input' in 'Intent CropImageContract.CreateIntent(Context context, CropImageContractOptions input)'. 4>Com.Vanniktech.AndroidImageCropper.Maui -> C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Com.Vannikteck.AndroidImageCropper.Maui\bin\Debug\net7.0-android\Com.Vanniktech.AndroidImageCropper.Maui.dll 4>Done building project "Com.Vanniktech.AndroidImageCropper.Maui.csproj". 4>The package Com.Vanniktech.AndroidImageCropper.Maui.4.4.0.5 is missing a readme. Go to https://aka.ms/nuget/authoring-best-practices/readme to learn why package readmes are important. 4>Successfully created package 'C:\Users\mrray\Source\Repos\ImageCropper.Maui3\Com.Vannikteck.AndroidImageCropper.Maui\bin\Debug\Com.Vanniktech.AndroidImageCropper.Maui.4.4.0.5.nupkg'. 5>------ Rebuild All started: Project: ImageCropper.Maui, Configuration: Debug Any CPU ------ 5>C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.7\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting true does not automatically include NuGet package references in your project. Update your project by including this item: . You can skip this warning by setting true in your project file. 5>C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.7\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting true does not automatically include NuGet package references in your project. Update your project by including this item: . You can skip this warning by setting true in your project file. 5>C:\Program Files\dotnet\packs\Microsoft.Maui.Sdk\8.0.7\Sdk\BundledVersions.targets(85,5): warning MA002: Starting with .NET 8, setting true does not automatically include NuGet package references in your project. Update your project by including this item: . You can skip this warning by setting true in your project file. 5>Done building project "Kotlin.Parcelize.Runtime.Maui.csproj". 5>Done building project "ImageCropper.Maui.csproj". 5>ImageCropper.Maui -> C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\bin\Debug\net8.0\ImageCropper.Maui.dll 5>ImageCropper.Maui -> C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\bin\Debug\net7.0\ImageCropper.Maui.dll 5>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\Platforms\iOS\PlatformImageCropper.cs(18,13,18,33): error CS0246: The type or namespace name 'TOCropViewController' could not be found (are you missing a using directive or an assembly reference?) 5>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\Platforms\iOS\PlatformImageCropper.cs(22,42,22,62): error CS0246: The type or namespace name 'TOCropViewController' could not be found (are you missing a using directive or an assembly reference?) 5>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\Platforms\iOS\PlatformImageCropper.cs(26,42,26,62): error CS0246: The type or namespace name 'TOCropViewController' could not be found (are you missing a using directive or an assembly reference?) 5>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\Platforms\iOS\PlatformImageCropper.cs(80,13,80,54): warning CA1422: This call site is reachable on: 'iOS' 16.1 and later, 'maccatalyst' 16.1 and later. 'UIApplication.KeyWindow' is obsoleted on: 'ios' 13.0 and later (Should not be used for applications that support multiple scenes because it returns a key window across all connected scenes.), 'maccatalyst' 13.0 and later (Should not be used for applications that support multiple scenes because it returns a key window across all connected scenes.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422) 5>Done building project "ImageCropper.Maui.csproj" -- FAILED. 5>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\Platforms\iOS\PlatformImageCropper.cs(18,13,18,33): error CS0246: The type or namespace name 'TOCropViewController' could not be found (are you missing a using directive or an assembly reference?) 5>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\Platforms\iOS\PlatformImageCropper.cs(22,42,22,62): error CS0246: The type or namespace name 'TOCropViewController' could not be found (are you missing a using directive or an assembly reference?) 5>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\Platforms\iOS\PlatformImageCropper.cs(26,42,26,62): error CS0246: The type or namespace name 'TOCropViewController' could not be found (are you missing a using directive or an assembly reference?) 5>C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\Platforms\iOS\PlatformImageCropper.cs(80,13,80,54): warning CA1422: This call site is reachable on: 'iOS' 17.2 and later, 'maccatalyst' 17.2 and later. 'UIApplication.KeyWindow' is obsoleted on: 'ios' 13.0 and later (Should not be used for applications that support multiple scenes because it returns a key window across all connected scenes.), 'maccatalyst' 13.0 and later (Should not be used for applications that support multiple scenes because it returns a key window across all connected scenes.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422) 5>Done building project "ImageCropper.Maui.csproj" -- FAILED. 5>ImageCropper.Maui -> C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\bin\Debug\net7.0-android\ImageCropper.Maui.dll 5>ImageCropper.Maui -> C:\Users\mrray\Source\Repos\ImageCropper.Maui3\ImageCropper.Maui\bin\Debug\net8.0-android\ImageCropper.Maui.dll ========== Rebuild All: 4 succeeded, 1 failed, 0 skipped ========== ========== Rebuild completed at 10:45 and took 50.122 seconds ==========

image

fatscally commented 2 weeks ago

I tried opening the Demo project and I'm not sure about the results...

image

We can assume it's not you, it's me!! 😄

jbowmanp1107 commented 2 weeks ago

Hi! Sorry for delay.. I didn't get notified for this new issue.. but did for the old issue..

I think I know what your issue is.. the nuget package TOCrop results in really really long file paths.. which can end up being over the 260 that Windows allows by default.. and if your base path is longer than like.. 15 characters.. it will end up going over if you install the NuGet from Visual Studio.. I tried fixing this by making the NuGet package name smaller.. but I have squeezed all I can out of it, and it still has this issue for some people.. But fret not there is a solution:

To work around it on Windows, you can use 'dotnet restore' on the solution from the CLI, and it gets around this limitation.. See if this fixes this current issue :). This works because the CLI tool allows long file paths, while Visual Studio itself does not..

fatscally commented 2 weeks ago

🤔 Hi Jeff. I think we're in different timezones - I'm in Dublin GMT so no worries on delayed responses.

I moved the project to "c:\ic3" giving path lengths of about 110 chars, and I ran the "dotnet restore" and anything else I could think of with no success so far. So ruling that out. C:\\ic3\\TOCropView.Maui\\TOCropViewController.xcframework\\ios-arm64_x86_64-simulator\\TOCropViewController.framework\\en.lproj\\TOCropViewControllerLocalizable.strings" = 162 chars.

Nuget automagically goes here:
C:\Users\mrray\.nuget\packages I moved the ImageCropper.Maui solution to here:
C:\ic3 ...(TOCropView.Maui\TOCropViewController.xcframework)

Looking at the errors: Update your project by including this item: <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" /> In your .csproj it is set to "8.0.14" so I tried updating mine and changing yours etc but still I can't get this to go away (on any of the installs).

I am zoning in on the iOS side of things now and possibly my setup regarding this. The file with the reported errors is .\ImageCropper.Maui\Platforms\iOS\PlatformImageCropper.cs

I opened ImageCropper.Maui properties and unselected "Target iOS" and it built ! image

Mine:
<TargetFrameworks>net8.0;net7.0</TargetFrameworks> Yours: <TargetFrameworks>net8.0;net7.0;net8.0-android;net7.0-android;net8.0-ios;net7.0-ios</TargetFrameworks>

5>Successfully created package 'C:\Users\mrray\source\repos\ImageCropper.Maui\Com.Vannikteck.AndroidImageCropper.Maui\bin\Debug\Com.Vanniktech.AndroidImageCropper.Maui.4.4.0.5.nupkg'. ========== Rebuild All: 5 succeeded, 0 failed, 0 skipped ==========

I'm looking into Macatlyst now. I saw that popup on the radar somewhere along the way. I am assuming your setup is primed for iOS development while I've never tried yet it on my laptop.

I don't have an networked Apple connected so I dunno if that's a blocker?