Trying to switch my monogame stuff from 3.5 to 3.6 and I immediately run into this issue. The only fix I see is copying sdl2.dll from folder where it's installed on my pc. This shouldn't happen on upgrading to a new version? Just wondering if it is something on my end. I also had two others create an empty monogame 3.6 from a template and they get the exact same error.
Same issue, with the same fix, happens on my end as well. Manually copying SDL2.dll from \MonoGame\v3.0\Assemblies\DesktopGL\x86 to the output folder of my game resolves the issue.
This is something we will definitely have to fix for 3.6.1 bugfix release.
I believe this is a template migration issue. A DesktoGL project from 3.5 will not work out of the box with 3.6, it needs new dependencies to the project, which the 3.6 template adds.
A migration documentation is required IMO.
You basically have to add two folders to your project:
And then add the related dependencies (SDL2 and OpenAL-Soft, in both x86 and x84 flavor) which you can find in your monogame install folder (Program Files\MonoGame\v3.0\Assemblies\DesktopGL\ as pointed by Aurioch) as a link, and to set these files build action to "none" and copy to output to "copy if newer".
When I create a fresh new project in Windows using the DesktopGL template, it works great. If I copy the same project to Ubuntu, it also works great, however on OS X I get missing .dll complaints that stops the building of the project.
For all files in the folders "x86" and "x64" I get an error like this
Error:null: /Library/Frameworks/Mono.framework/Versions/4.6.2/lib/mono/xbuild/14.0/bin/Microsoft.Common.targets : error : Cannot copy /Library/Frameworks/Mono.framework/External/xbuild/MonoGame/v3.0/Assemblies/DesktopGL/x86/SDL2.dll to /Users/pers/Documents/MonoGameTest/Template/bin/DesktopGL/AnyCPU/Debug/x86/SDL2.dll, as the source file doesn't exist.
I had to check, and the files are indeed missing, I can tell by examining the file "MonoGame.Framework.dll.config" that all the missing files are intended for Linux, however I don't quite understand how I am supposed to compile the project on OS X.
The MonoGameGL nuget packages do not include this DLL either.
Another thing with the nuget package is that when making a new project from template the file "MonoGame.Framework.dll.config" is set to "Copy if newer", however when it comes from a nuget package it is set to "do not copy".
That issue currently blocks me from switching to 3.6 馃槩
Could you please release a new NuGet package?
You could just include the native libraries manually.
Hello,
To fix this issue, you will need to migrate your project from MonoGame 3.5 to MonoGame 3.6. To do so, please follow these steps:
Edit your game csproj file with a text editor. Locate the following line:
<MonoGameContentReference Include="Content\Content.mgcb" />
And add the following content just after this line:
<None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x86\SDL2.dll">
<Link>x86\SDL2.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x64\SDL2.dll">
<Link>x64\SDL2.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x86\soft_oal.dll">
<Link>x86\soft_oal.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x64\soft_oal.dll">
<Link>x64\soft_oal.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x86\libSDL2-2.0.so.0">
<Link>x86\libSDL2-2.0.so.0</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x64\libSDL2-2.0.so.0">
<Link>x64\libSDL2-2.0.so.0</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x86\libopenal.so.1">
<Link>x86\libopenal.so.1</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\x64\libopenal.so.1">
<Link>x64\libopenal.so.1</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\libSDL2-2.0.0.dylib">
<Link>libSDL2-2.0.0.dylib</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\libopenal.1.dylib">
<Link>libopenal.1.dylib</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll.config">
<Link>MonoGame.Framework.dll.config</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="app.manifest" />
This should fix your migration issue without having the need to copy manually the SDL files to your output folder.
Note that this is for a Cross Platform Desktop project, the lines will be different for another type of project!
Note that this is for a Cross Platform Desktop project, the lines will be different for another type of project!
You won't need to do any of this for other project types because dependencies did not change.
The dev release version of the NuGet @Thraka includes the DLL. It was missed on the 3.6 release.
The next release version of the NuGet will also include it, otherwise, use the dev release source on the MG Downloads page and use NuGet to get it from there.
why wait almost 5month to update the nuget?
Don't shoot the messenger :D
It's a subject of hot debate about release cycles and what is published. Feel free to bring it up on the Gitter channel for discussion and see if it can be improved with the MG core team.
For me it was fixed when i had lowered MonoGame.Framework.WindowsDX version to 3.4.0.459 instead 3.6.0.1625:
This discussion is related to the SDL dependency, which is only for Cross Platform Desktop (DesktopGL) projects, not WindowsDX. I don't think it's a good idea to lag behind the latest MG version that much, because a lot of bug fixes have made it into MG since then.
Can confirm that it works fine on OSX (tested using VS for Mac) with monogame v3.6 installed.
Came here because I got the same errors as @persn. The errors were because I din't have monogame installed 馃槄
If you're on OSX and using VS for Mac, this template works with no configuration needed (except for installation of monogame ofcourse).
Tried to write a monogame example for F# and dotnet core with vscode and paket and ran into this. I tried adding the SDL2 nuget repository and dragging that file to the output folder but no dice. I might need to reference the SDL2.dll in the fsproj file?
Edit: reading the comments I might need to install monogame...
it would be really neat if I could get all these dlls in a nuget package.
it would be really neat if I could get all these dlls in a nuget package.
They have been added to the nuget.
PS. If you are trying to setup .NET Core templates, use: https://www.nuget.org/packages/MonoGame.Framework.DesktopGL.Core/
ahhh thanks so much cra0zy. :trophy:
New project templates have been fixed, and the SDL dependencies have been included in the nuget package (of course in devel branch). Closing...
@cra0zy Hi! When i try publish on mac os (10.13.6 high sierra) using this example
https://github.com/dotnet/corert/tree/master/samples/MonoGame
I get an error
Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'libSDL2-2': The specified module could not be found.
at MyGame!<BaseAddress>+0x1f3740
at MyGame!<BaseAddress>+0x1f35cc
at Sdl.GetVersion(Sdl.Version&) + 0x3c
at Microsoft.Xna.Framework.SdlGamePlatform..ctor(Game) + 0x74
at Microsoft.Xna.Framework.Game..ctor() + 0x41c
at MyGame.Game1..ctor() + 0x14
at MyGame.Program.Main() + 0x18
at MyGame!<BaseAddress>+0x2902f8
publish cmd
dotnet publish -r osx-x64 -c release
libSDL2-2.dylib exists in folder
The file should be libSDL2-2.0.0.dylib, not libSDL2-2.dylib. Could you verify this?
Also, are you using cra0zy netcore branch? https://github.com/cra0zy/MonoGame/tree/core
Yes libSDL2-2.dylib screen

And yes i using netcore branch, my csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<DefineConstants>$(DefineConstants);WINDOWS;LINUX</DefineConstants>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>
<ItemGroup>
<MonoGameContentReference Include="**\*.mgcb" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-*" />
<PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.4" />
<PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.7" />
</ItemGroup>
<ItemGroup>
<RdXmlFile Include="rd.xml" />
</ItemGroup>
</Project>
He is using the .NET Core version so the filename is not the same.
Don't know whats causing the issue tho.
Most helpful comment
Don't shoot the messenger :D
It's a subject of hot debate about release cycles and what is published. Feel free to bring it up on the Gitter channel for discussion and see if it can be improved with the MG core team.