Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to add Content files from referenced assembly in app bundle

$
0
0

I have Xamain.Mac project named MainApp (Xamarin Mac Full 4.8), which references the Class Library project named Lib (Net FW 4.8).
The Lib project have the txt file ContentFile.txt with Build Action = Content and Copy to output directory = Always. The ContentFile.txt contains some data, needed by Lib to work.

When building the solution, I expect that ContentFile.txt will be included in Application bundle (MainApp.app).
But actually I am observing following behaviour:

  • ContentFile.txt is present in the Lib project output folder (/Lib/bin/Debug/ContentFile.txt) along with the Lib.dll
  • ContentFile.txt is present in the MainApp project output folder (/MainApp/bin/Debug/ContentFile.txt) along with the Lib.dll and MainApp.exe
  • ContentFile.txt is not present in the MainApp.app application bundle (/MainApp/bin/Debug/MainApp.app). But Lib.dll is present inside the bundle (so, looks like the build system determined Lib.dll dependency correctly).

So, the question is - how to configure solution to include Content files from inside referenced projects to the main application bundle? Ideally, without any explicit references to these content files outside the Lib project.

What I already tried, but all of this looks not very good:

  • add explicit reference to ContentFile.txt in the MainApp project with Build action = bundle resource.
  • extract ContentFile.txt in the separate Shared project, then reference this shared project it both Lib and MainApp projects.
  • use postbuild events in MainApp project to copy file.

All of this worked, but required to 'leak' internal information from inside Lib project and I wonder if the better solutions are exist.

Additional note: the Lib project is also used in Windows version of my app, so I can't change Lib project in any way that will make it incompatible with windows.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>