Nevermind, I found the solution here ... on this forum :)
What I actually tried was implement the XNB creation and loading into an XNA 3.1 project, not a winforms project.
To implement this solution in a XNA 3.1 project do the following.
1. Add the following two references and make sure to pick the correct versions:
* Microsoft.Build.Engine, version 2.0
* Microsoft.Build.Framework, version 2.0
2. From the example project to load content (version 3.0!), that you find here, copy these 3 files to your own project:
ContentBuilder.cs
ErrorLogger.cs
App.config
(I created these files in my project with Add->New Item, and then only copied the content.)
3. In the ContentBuilder.cs file, change the following 3 lines. (basically you just change the version numbers to 3.1):
| const string xnaVersion = ", Version=3.1.0.0, PublicKeyToken=6d5c3888ef60e27d"; |
| msBuildProject.SetProperty("XnaFrameworkVersion", "v3.1"); |
| msBuildProject.AddNewImport("$(MSBuildExtensionsPath)\\Microsoft\\XNA Game Studio\\v3.1\\Microsoft.Xna.GameStudio.ContentPipeline.targets", null); |
4. Copy the LoadModel() method from the MainForm.cs file in the example project.
I changed this method to use the standard Game.Content to load the model.
For the standard content manager to find the generated XNB files, the ContentBuilder must place the XNB files in the my_project\bin\x86\Debug\Content folder. To do this, change the outputPath string in the ContentBuilder.CreateBuildProject to my_project\bin\x86\Debug. The model will then be created in the Content subfolder.
That's it. Just call the LoadModel() function to load a model.
Notice that this solution still uses the v2.0 build engine. I may try add a post on getting this to work with the 3.5 version as well (I read a post on this somewhere).
If that works, you'll read about this in the next reply.