Browse MonoGame framework source code witnin the Visual Studio project

Hi All,

I’d like to be able to browse MonoGame framework source code from within Visual Studio Community 2019 in a similar manner that I browse the code I have written.
Is there is a way to link the downloaded Monogame framework source code in my project, so that I can click the class name and VS open the code?

Thanks for your answers

#IDE, #Visual Studio

If you only want to look at the code, but not modify it https://docs.microsoft.com/en-us/visualstudio/debugger/decompilation?view=vs-2019

1 Like

Get the source code and add it to VS as a project and reference it from your game (instead of referencing the dll).

I end up using the source code instead of dlls wherever I can and it’s great for debugging and I’ve actually made a bunch of changes to the monogame framework (including performance improvements).

1 Like

Hi, I’m trying to do the same, but when I remove the dll reference, I get an error “The MonoGamePlatform property was not defined in the project!” from MonoGame.Content.Builder.Task.targets.
Each project on its own is fine, I’ve modified the .csproj file in both projects to make them target net452 and they both build on their own, until I reference the framework and remove the reference to the dll, and I get this error.
The MonoGamePlatform enum is only referenced by PlatformInfo.MonoGamePlatform, but there is no reference to that property.

1 Like

The MonoGamePlatform property is somehow defined through the referenced dll, it gets removed along with it. You can add it back in manually in your csproj file. For every configuration there is a PropertyGroup tag, you have to add the MonoGamePlatform tag as a child:

<PropertyGroup>
  <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  ...
  <MonoGamePlatform>Android</MonoGamePlatform>
</PropertyGroup>

Replace Android with whatever platform your are targeting.

2 Likes

Thank you, that did it! It also helps me understand how all this stuff works.
Thanks everyone! :slight_smile:

1 Like

Thanks @poohshoes for your reply.
The download sourcecode contains several projects found in the package root folder, such as MonoGame.Framework.Android.sln, MonoGame.Framework.DesktopGL.sln, MonoGame.Framework.WindowsDX.sln.
Opening these solutions and trying to build them, indicate some missing third party source code or reference dll/assemblies.

Did you reference any of these solutions in your project? instead of the corresponding reference assembly? Or did you just created a new project and added to it all the code found under MonoGame.Framework directory?
Thanks for your elaboration.

I’m using the MonoGame.Framework.Windows project and I am referencing the library for SharpDX to do that. You can use the source for SharpDX if you want but I am still using DLL’s

1 Like