This project has moved and is read-only. For the latest updates, please go here.

Vector2 Error

Topics: Developer Forum
Mar 30, 2013 at 8:42 PM
I am working on a MonoGame program that uses Farseer physics. But every time I make a new Vector2 it throws an 3 errors that say:
Error 1 The type 'Microsoft.Xna.Framework.Vector2' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Xna.Framework, Version=, Culture=neutral, PublicKeyToken=842cf8be1de50553'. C:\Users\Nathan\Documents\Visual Studio 2012\Projects\Farseer\Farseer\Game1.cs 28 13 Farseer

Error 2 The best overloaded method match for 'FarseerPhysics.Dynamics.World.World(Microsoft.Xna.Framework.Vector2)' has some invalid arguments C:\Users\Nathan\Documents\Visual Studio 2012\Projects\Farseer\Farseer\Game1.cs 28 21 Farseer

Error 3 Argument 1: cannot convert from 'Microsoft.Xna.Framework.Vector2 [c:\Program Files (x86)\MonoGame\v3.0\Assemblies\WindowsGL\MonoGame.Framework.dll]' to 'Microsoft.Xna.Framework.Vector2' C:\Users\Nathan\Documents\Visual Studio 2012\Projects\Farseer\Farseer\Game1.cs 28 31 Farseer

In this instance I was recreating the error by trying to make a new world.
Here is the code:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.GamerServices;
using FarseerPhysics.Dynamics;

//Error Line
World world = new World(new Vector2(50f, 50f));
Apr 4, 2013 at 6:18 PM

you'll need to build the Farseer.dll using the VS10 project which you can download here on codeplex. However, you have to delete the XNA References and replace them with the MonoGame.dll. You can then use the generated Farseer.dll and it'll work just fine.

I've had this problem, too, so if you don't want to do the steps described above, you can just use these dlls:
I hope uploading these and linking them here isn't a problem.
Jun 28, 2013 at 3:19 AM
The link is dead and I can't seem to figure out how to replace the xna references. Could you either explain or repost the edited dll? I'd appreciate it.
Jun 28, 2013 at 7:11 AM
Edited Jun 28, 2013 at 10:08 AM
The link should work again now. If you still have problems, let me know and I'll get back to it later this day/tomorrow.