سؤال

Can I reference a Content Project to a Non-XNA project (MonoGame, if it's important)?

هل كانت مفيدة؟

المحلول

Not directly.

The ability to add a content project reference to a project is only available for projects of the types "XNA Game" and "XNA Game Library".

One trick that I use when I want to build and include an XNA Content Project in a WinForms project is to make an empty XNA Game Library project. Reference the XNA Game Library project from the main (Windows) project, and the Content Project from the XNA Game Library project.

Whether this will work for MonoGame is another matter.

The alternative is to simply have a blank XNA Game project that references the content project. Then set up the project dependencies so the XNA Game will rebuild first if necessary. If you need to copy the output files around, perhaps do it as a post-build step?

The sledgehammer option would be to create a custom MSBuild file that does exactly what you want.

نصائح أخرى

I know you already have it solved but yesterday I was having the same problem, Tom Spillman sent me this link:

https://github.com/mono/MonoGame/wiki/MonoGame-Content-Processing

So apparently you can reference it directly

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top