I am pretty new to C#, but not Visual Studio, and I wonder if anyone can tell me how I reference the MonoGame.Framework nuget package from a shared library? The shared library would be used to share code amongst projects targeting different platforms.
Nevermind - it looks like I used the wrong project template to create my library. If I use the MonoGame shared library template then it references MonoGame.Framework.DesktopGL.
As an aside, I notice this library project contains a Content folder with a Content.mgcb. Does that mean I can package common content using this?
That’s excellent! Forgive my ignorance, but what does this look like during deployment? I know that the Content folder will be copied to the target directory, so is the Content of both the app and the shared library put into the same directory? There is no “bundle” concept is there, like with macOS/iOS?
You can also try MonoGame Kickstarter if you like. Using one command it will setup a solution for Visual Studio and setup one or ore projects (windows directx, opengl crossplatform) together with a project for your shared code and content.
You can then add or remove more projects if you like, it just does automates the manual steps for you.
Here is a video of it showing the command and starting the generated MonoGame project (again you can open it with visual studio also etc).
If you need support just let me know. I think it may look complicated but it really is not. Basically you would just download the script (monogame-kickstarter.sh) file. Make it executable. Run it providing only a solution name as parameter. Hit Enter and everything should be in a folder named like the solution name in a short time like you see in the demo video.
To run the script you need either run it in bash (linux) or git bash (windows). On the YouTube channel you find another video with a linux demo too…
Hey sorry to bother you again. I have a skeleton version of my library working with an effect file (.fx) in the shared library Content, and this effect file is being compiled into shared library output folder Content/bin/DesktopGL/Content.
However the main executable is a UWP app with it’s own Content and the shared library Content does not appear in the AppX target directory. I assume I need a post-build step to copy the library Contents over? Have you had this working yourself in the past?
No it’s a single game app and a single library. Are you using a UWP app?
For the time being I have moved all content into the app and made the ContentsManager available to the library and that will be good enough, at least for now.
@Synammon I am using 3.8. Weird. I did have to add the MonoGame.Content.Pipeline.Task to the shared library in order for it to process the Content.mgcb in the first place, but after that the directory was appearing the target dir of the shared library, just not in the target dir of the app.
I wonder if I’m missing a reference of some sort from the app to the shared library? All I did to start using the library was to right-click the app project and do Reference > Add.
I did not have to add MonoGame.Content.Pipeline.Task to my shared library. It just built out of the box. That might be part of the problem. Maybe there is something wrong with the template.