Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

How do I reference content from an external library I have created?

$
0
0
Hi all,

I having trouble correctly referencing a content project of an external library project I have created.

I created a windows game library project ('ComponentLibrary') and added a content project ('ComponentLibraryContent') with a content reference included in the game library project.


When I add a reference to a the ComponentLibrary there are no issues with obtaining the components of the library, however the references to the ComponentLibraryContent throws 'Error loading "{file}". File not found' errors, unless I add the ComponentLibraryContent project to my game project and add a content reference to it.

I've noticed the ComponentLibraryContent does not have '(content)' next to it's name and am wondering if this is why I cannot reference the content in my game projects.

I've set up the Content in my ComponentLibrary project to its own content manager, so that the game projects I create can include it's own content project with additional content resources.
public readonly GraphicsDeviceManager Gdm;
// Component Library Content
public ContentManager ComponentContent;
public IServiceContainer ComponentServices = null;


protected override void LoadContent()
{
    ComponentServices = new ServiceContainer();
    ComponentServices.AddService(typeof(IGraphicsDeviceService), this.Gdm);
    ComponentServices.AddService(typeof(IGraphicsDeviceManager), this.Gdm);
    ComponentContent = new ContentManager(ComponentServices, "ComponentLibraryContent");
}


So, as I mentioned, even though I can work around the issue by adding the ComponentLibraryContent project to my game solution and adding a content reference, I can also modify the content of the ComponentLibraryContent and this is not ideal.

If anyone can assist me in correctly referencing the ComponentLibraryContent I would be most grateful. If you need additional information, I would gladly provide more.

Cheers,
Andrew.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



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