Skip to content
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

Documentation or any pointers for building the project #121

Closed
beeradmoore opened this issue May 23, 2023 · 4 comments
Closed

Documentation or any pointers for building the project #121

beeradmoore opened this issue May 23, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@beeradmoore
Copy link
Collaborator

beeradmoore commented May 23, 2023

Hey @dimonovdd ,
I'd like to make some changes to Xamarin.MediaGallery (see #122) regarding the differences between iOS and Android and how they handle albums. I think the changes should be quite simple, but currently I am unable to build the project.

I am using macOS + Visual Studio 2022. I am able to build and deploy both Xamarim.MediaGallery.Sample and Xamarim.MediaGallery.Sample.Maui but it appears that in both instances Xamarim.MediaGallery.targets is forcing those projects to use the nugets (see the _UseNuget here).

Changing _UseNuget to be false I would hope that it would then use the csproj files and build from source but there appears to be issues with it generating NativeMedia.dll. Poking around at this for an hour I was not able to find a resolution.

I then changed tactic and made a new Xamarin.Forms project and added source for Permission and MediaGallery to my solution and tried to get it to build from source that way to no avail.

Third tactic I tried was to build the project manually with msbuild, but building just resulted in compilation errors no matter how I tired to build and what I tried to target.

Is there any info you can provide on how you build it from source. I can see from your comment here that you were building from cli.
I am more than happy to build on cli and manually dump dlls in my test project to test the new code out before I update the samples and send it all off as a PR.

@dimonovdd
Copy link
Owner

Thanks to Microsoft. It's really difficult.

The easiest way:

  1. Open Xamarim.MediaGallery.sln
  2. Delete all "*.Maui" projects (Sample.Common.Maui and etc.)
  3. Remove all net6.0 TargetFrameworks in other projects
  4. Clean projects
  5. Close IDE
  6. Open Xamarim.MediaGallery.sln

@beeradmoore
Copy link
Collaborator Author

Thanks for the quick reply. That got it working. Will get started on those changes.

@beeradmoore
Copy link
Collaborator Author

I spoke too soon. Appears the demo will compile and run. And appears it does not like it when I have errors in the MediaGallery project. But for some reason it does not like additional arguments added onto SaveAsync. Says SaveAsync with 4 arguments does not exist, but IDE seems to not only show me it exists it shows the comment I added to the doc tags about the new argument 😂

I'll keep fiddling and see what I can do.

@beeradmoore beeradmoore reopened this May 24, 2023
@beeradmoore
Copy link
Collaborator Author

Got it. I reverted my csproj/sln/targets changes.

Leaving a list of things I did that worked for me here for the next person to find.

  1. From Finder, manually delete all the .Maui folders and .sln files.
  2. Open the entire project in VSCode.
  3. Search for anything containing maui and remove it (when removing from solution files)
  4. Change any netstandard2.0 to netstandard2.1. No idea why, IDE didn't like it.
  5. Remove _UseNuget from any csproj file (it's just in one)
  6. Remove any ItemGroup that seems to want to support _NET6.
  7. Force it to use csproj to build instead of nuget (in Xamarim.MediaGallery.targets
<PackageReference Condition="'$(_UseNuget)'=='true'" Include="Xamarin.MediaGallery.Permision" Version="$(_PermissionLibVersion)" />
		<ProjectReference Condition="'$(_UseNuget)'!='true'" Include="$(MSBuildThisFileDirectory)\Permission\Xamarin\Permission.csproj" />

should become

<ProjectReference Include="$(MSBuildThisFileDirectory)\Permission\Xamarin\Permission.csproj" />
  1. Do the same for MediaGallery just below it as well.
  2. Open Xamarim.MediaGallery.sln in Visual Studio.
  3. Manually build Permissions and MediaGallery.
  4. Build and deploy Android/iOS sample.

For any changes made I needed to manually build MediaGallery again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants