Assembly not found for framework Mono / NET 4.5

I installed MonoGame 3.5 with Monodevelop on Debian. I made a project with VS on windows but now when i try to open it on debian i have this error:

Assembly not found for framework Mono / NET 4.5

How can i fix it? Thanks!

You probably need to upgrade your mono installation. I assume the one that comes from Debian is out of date. @harry-cpp?

I installed the Xamarin packages. I think they are the newest version of mono.

More likely that the original templates were generated with MG 3.4, and then copied over, that way the references would be wrong.

@Shugui post us your .csproj file

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProjectGuid>{7F26D627-04EB-42D5-89EC-3CC2DAF8A3D6}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>BHMotor2D</RootNamespace>
    <AssemblyName>BHMotor2D</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <MonoGamePlatform>Windows</MonoGamePlatform>
    <MonoGameContentBuilderExe>
    </MonoGameContentBuilderExe>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Windows\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Windows\Release\</OutputPath>
    <DefineConstants>TRACE;WINDOWS</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationIcon>Icon.ico</ApplicationIcon>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="Display\GameObjects\Ground.cs" />
    <Compile Include="Display\GameObjects\PieceL.cs" />
    <Compile Include="Display\GameObjects\PieceLong.cs" />
    <Compile Include="Display\Screens\ControllerScreen.cs" />
    <Compile Include="Display\GameObjects\Entity.cs" />
    <Compile Include="Display\GameObjects\Piece.cs" />
    <Compile Include="Display\GameObjects\Player.cs" />
    <Compile Include="Display\Screens\GameScreen.cs" />
    <Compile Include="Display\ISprite.cs" />
    <Compile Include="Display\Screens\MenuScreen.cs" />
    <Compile Include="Game1.cs" />
    <Compile Include="Display\GameObjects\Button.cs" />
    <Compile Include="Global.cs" />
    <Compile Include="Physics\Collidable.cs" />
    <Compile Include="Physics\Gravitable.cs" />
    <Compile Include="Physics\ICollidable.cs" />
    <Compile Include="Physics\IGravity.cs" />
    <Compile Include="Physics\IUpdatable.cs" />
    <Compile Include="Physics\Movable.cs" />
    <Compile Include="Physics\NoCollidable.cs" />
    <Compile Include="Physics\NoGravitable.cs" />
    <Compile Include="Physics\NoMovable.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Display\Screens\Screen.cs" />
    <Compile Include="Display\Screens\ScreenManager.cs" />
    <Compile Include="Physics\Visible.cs" />
    <Compile Include="Physics\InVisible.cs" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="MonoGame.Framework">
      <HintPath>$(MSBuildProgramFiles32)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="Icon.ico" />
  </ItemGroup>
  <ItemGroup>
    <MonoGameContentReference Include="Content\Content.mgcb" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

And I was right…

  1. Your project was a Windows project, you wouldn’t be able to even run that on Linux
  2. Your references are also using the outdated 3.4 version

I would suggest you create a new DesktopGL project from templates and add all the classes/content to it

I can’t guarantee that this will work, but here is a modified version of your .csproj file that should work:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProjectGuid>{7F26D627-04EB-42D5-89EC-3CC2DAF8A3D6}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>BHMotor2D</RootNamespace>
    <AssemblyName>BHMotor2D</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <MonoGamePlatform>DesktopGL</MonoGamePlatform>
    <MonoGameContentBuilderExe>
    </MonoGameContentBuilderExe>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\DesktopGL\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\DesktopGL\Release\</OutputPath>
    <DefineConstants>TRACE;WINDOWS</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationIcon>Icon.ico</ApplicationIcon>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="Display\GameObjects\Ground.cs" />
    <Compile Include="Display\GameObjects\PieceL.cs" />
    <Compile Include="Display\GameObjects\PieceLong.cs" />
    <Compile Include="Display\Screens\ControllerScreen.cs" />
    <Compile Include="Display\GameObjects\Entity.cs" />
    <Compile Include="Display\GameObjects\Piece.cs" />
    <Compile Include="Display\GameObjects\Player.cs" />
    <Compile Include="Display\Screens\GameScreen.cs" />
    <Compile Include="Display\ISprite.cs" />
    <Compile Include="Display\Screens\MenuScreen.cs" />
    <Compile Include="Game1.cs" />
    <Compile Include="Display\GameObjects\Button.cs" />
    <Compile Include="Global.cs" />
    <Compile Include="Physics\Collidable.cs" />
    <Compile Include="Physics\Gravitable.cs" />
    <Compile Include="Physics\ICollidable.cs" />
    <Compile Include="Physics\IGravity.cs" />
    <Compile Include="Physics\IUpdatable.cs" />
    <Compile Include="Physics\Movable.cs" />
    <Compile Include="Physics\NoCollidable.cs" />
    <Compile Include="Physics\NoGravitable.cs" />
    <Compile Include="Physics\NoMovable.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Display\Screens\Screen.cs" />
    <Compile Include="Display\Screens\ScreenManager.cs" />
    <Compile Include="Physics\Visible.cs" />
    <Compile Include="Physics\InVisible.cs" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="MonoGame.Framework">
      <HintPath>$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll</HintPath>
    </Reference>
    <Reference Include="OpenTK">
      <HintPath>$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\OpenTK.dll</HintPath>
    </Reference>
    <Reference Include="NVorbis">
      <HintPath>$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\NVorbis.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="OpenTK.dll.config">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Content Include="Icon.ico" />
  </ItemGroup>
  <ItemGroup>
    <MonoGameContentReference Include="Content\Content.mgcb" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

The new .csproj didnt work but thanks anyway. I’ll try your advice of make a new DesktopGL project. But i have other question.
Is there any way to do a project in two differents pc (linux, windows) and have it sync with git? And of course the project would be able to run in both computers.