Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build .tmx files. TiledMapTilesetProcessor showing a MissingMethodException #783

Open
fhb93 opened this issue Aug 12, 2022 · 24 comments

Comments

@fhb93
Copy link

fhb93 commented Aug 12, 2022

Hello, I'm trying to migrate a project from Windows to an M1 Macbook Air, so I can handle adjustments to run my game on Intel & Apple Silicon hardware too. After setting everything up I've found that MGCB cannot build the TiledMap files into xnb.
The mgcb build task stops in an System.MissingMethodException. After one day seeking for a fix, I downloaded and tried to build the Monogame Extended samples to check if the issue is happening only with my project. Below is the exact output from the CLI mgcb (Issue happens with MGCB-editor and CLI mgcb). The sample project in question is the Platformer one.

/Users/username/Downloads/MonoGame.Extended-samples-master/src/Games/Platformer/Content/test-map.tmx: error: Processor 'TiledMapTilesetProcessor' had unexpected failure! System.MissingMethodException: Method not found: 'Microsoft.Xna.Framework.Color Microsoft.Xna.Framework.Color.get_TransparentBlack()'. at MonoGame.Extended.Content.Pipeline.Tiled.TiledMapTilesetProcessor.Process(TiledMapTilesetContentItem contentItem, ContentProcessorContext context) at Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor`2.Microsoft.Xna.Framework.Content.Pipeline.IContentProcessor.Process(Object input, ContentProcessorContext context) in /home/runner/work/MonoGame/MonoGame/MonoGame.Framework.Content.Pipeline/ContentProcessor.cs:line 60 at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent(PipelineBuildEvent pipelineEvent) in /home/runner/work/MonoGame/MonoGame/MonoGame.Framework.Content.Pipeline/Builder/PipelineManager.cs:line 717

Any ideas on what is going on? Thanks in advance 🙂

@devme0
Copy link

devme0 commented Aug 20, 2022

I am facing the same issue :

image

I am running on Windows 11 with Visual Studio 2022, the project uses the Android template. I am using an embedded tile set with a single tile set image for the tile map made using Tiled.

Referenced Versions:

    <PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" />
    <PackageReference Include="MonoGame.Extended" Version="3.8.0" />
    <PackageReference Include="MonoGame.Extended.Content.Pipeline" Version="3.8.0" />
    <PackageReference Include="MonoGame.Extended.Tiled" Version="3.8.0" />
    <PackageReference Include="MonoGame.Framework.Android" Version="3.8.1.303" />

The Content.mgcb file:


#----------------------------- Global Properties ----------------------------#

/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:Android
/config:
/profile:Reach
/compress:False

#-------------------------------- References --------------------------------#

/reference:..\..\..\..\..\.nuget\packages\monogame.extended.content.pipeline\3.8.0\tools\MonoGame.Extended.Content.Pipeline.dll

#---------------------------------- Content ---------------------------------#

#begin Tile/gamemap.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:Tile/gamemap.tmx

#begin Tile/rect111.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Tile/rect111.png


I have been at it for two days now, any help will be highly appreciated.

@devme0
Copy link

devme0 commented Aug 20, 2022

Even downgrading the MonoGame.Content.Builder.Task and MonoGame.Framework.Android version to 3.8.0 still throws the same error:

    <PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0" />
    <PackageReference Include="MonoGame.Extended" Version="3.8.0" />
    <PackageReference Include="MonoGame.Extended.Content.Pipeline" Version="3.8.0" />
    <PackageReference Include="MonoGame.Extended.Tiled" Version="3.8.0" />
    <PackageReference Include="MonoGame.Framework.Android" Version="3.8.0" />

@MetaFight
Copy link

I found downgrading mgcb to version 3.7.0 fixed the issue, but unfortunately this left my pipeline artifacts in an unusable version.

@damian-666
Copy link

damian-666 commented Sep 6, 2022 via email

@MetaFight
Copy link

Thanks for the nudge in the right direction. I had a quick look at the mg-e code and it looks like the dependence on Color.TransparentBlack has already been removed. I'll try to build a new Tiled pipeline extension (or whatever it's called) from the latest sources when I've got a bit of time. Hopefully the issue is already fixed and we just need a new build/nuget package.

@MetaFight
Copy link

MetaFight commented Sep 7, 2022

I've made some progress with this.

I'm able to build and use Tile content with the following component versions

  • Monogame.Extended.Content.Pipeline built from the latest source
  • dotnet-mgcb v3.8.1.303
  • Monogame.Framework v3.8.0.1641
  • Monogame.Extended.Tile v3.8.0

This seems to work because the latest source of Monogame.Extended.Content.Pipeline no longer references Color.TransparentBlack. Unfortunately, the produced assets only work with Monogame.Framework 3.8.0 and not the latest 3.8.1

@damian-666
Copy link

damian-666 commented Sep 8, 2022 via email

@MetaFight
Copy link

Are you asking about the Monogame.Extended.Content.Pipeline.dll file? I put it with my other project external dependencies.
I used the content editor to add a reference to it.
I think there's currently also a bug with relative paths not working in .mgcb files so you'll need to double check that the reference uses an absolute path. I did this by opening the file in a text editor.

Hopefully that helps.

@damian-666
Copy link

i have relative paths working but i put hte mgcb wiht the content in a shared net6 core.. then i link the mgcb to the exe project ... its relative so theres no internal relative path in the mgcb.. i dont link the assets themselves nor copy them.. they are set to None.. the content builder takes care of all that... ... i use ....bin not problem on windows as a base path its min my ..https://github.com/damian-666/MGShadersXPlatform/blob/master/MGXPlatformNet6.sln sample and the files copy.. its important to have the new content builder and rebuld your project files if yo are moving to net6 you have to change tons of tooling and erase old stuff... then new tool and msbuild is way better but it takes time.

but im not using extended content or even mp3 yet.. my sample might help yoyu tho as it copies the content to the right places. feel free to update it with mp3 and or whatever because there are no other new samples that show shared core multiplatfrom developement.. that is the only way to avoid repeat assets or code that i konw of and the simple sample i started with .. is 3.1 netcore and 2 years old..

.. make sure you have the .config folder at your root....{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-mgcb": {
"version": "3.8.1.303",
"commands": [
"mgcb"
]
},
"dotnet-mgcb-editor": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor"
]
},
"dotnet-mgcb-editor-linux": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-linux"
]
},
"dotnet-mgcb-editor-windows": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-windows"
]
},
"dotnet-mgcb-editor-mac": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-mac"
]
}
}
}

im having trouble with https://github.com/craftworkgames/MonoGame.WpfControl in another vault.... i get mtheod not found.. * getShartedHaldle* when i acces the rendertexture... in the view module.. its a sharpDX thing.. i think i have to bild monogame and then find out becausethe sample works i put a PR., and theer is another PR im gong to try his version.. . but im using legacy 48 components a detcore windows 6 exe and a only DevCompnonetsRibbon docing system.. its using tabbed dialogs. ill put the issue there but tabbed dialgs were never supported...

btw its 5 weeks and im 99 % though all this... its for 2 years LTS so i hope i dont have to do this again... the biggest pain for me was netstandard 2 dropped bu you can use old dependencies... msft command line upgrade -assistant mgiht help also.. or it might make a mess... the upside is my netcore6 libs are faster and projects cleaner.

@kolen
Copy link

kolen commented Oct 26, 2022

Seems that it's fixed in #735. Works for me in latest develop cbbec7d when building MonoGame.Extended.Content.Pipeline.dll from source.

@MetaFight
Copy link

#783 (comment)

Indeed it does. When I checked there wasn't a new build and MonoGame 3.8.1 wasn't supported yet.

@lithiumtoast
Copy link
Contributor

@kolen @MetaFight Latest builds are automatically deployed to MyGet. E.g. https://www.myget.org/feed/lithiumtoast/package/nuget/MonoGame.Extended/3.9.0-alpha0079.

@8bitAlex
Copy link

+1 still an issue

@iNewmanity
Copy link

Yeah, got this error too. Does anyone now, if the TileMap-Object is compatible with the TMX one from tiledsharp?

@Lalayqz
Copy link

Lalayqz commented Apr 5, 2023

My problem got solved by upgrading MonoGame.Extended & MonoGame.Extended.Content.Pipeline & MonoGame.Extended.Tiled to 3.9.0-alpha0093.

@iNewmanity
Copy link

My problem got solved by upgrading MonoGame.Extended & MonoGame.Extended.Content.Pipeline & MonoGame.Extended.Tiled to 3.9.0-alpha0093.

Could you please tell me, how to do it? Last Time i tried this, i got an error. I need this to work! Thank you in advance!

@Lalayqz
Copy link

Lalayqz commented Apr 7, 2023

My problem got solved by upgrading MonoGame.Extended & MonoGame.Extended.Content.Pipeline & MonoGame.Extended.Tiled to 3.9.0-alpha0093.

Could you please tell me, how to do it? Last Time i tried this, i got an error. I need this to work! Thank you in advance!

I'm not an expert at this, but here's what I did.
In Visual Studio, use the search bar on the top go to the "Manage NuGet Packages..." page.
Then add a new "MyGet" package source there, because alpha builds are deployed to "MyGet", not the default "nuget.org".
image

Then upgrade to alpha builds using this "MyGet" package source.
image

@iNewmanity
Copy link

Thanks a lot for your help; Helped me add the Alpha Package, but i still got issues. Now the MGCB-Editor shows System.NotSupportedException. Any hint where I can find a solution to that :)

@Lalayqz
Copy link

Lalayqz commented Apr 7, 2023

Thanks a lot for your help; Helped me add the Alpha Package, but i still got issues. Now the MGCB-Editor shows System.NotSupportedException. Any hint where I can find a solution to that :)

no idea on this one because I never got this issue D:
but you can open a new issue and provide more details there if you can't find a solution online.

@gldraphael
Copy link

For anyone looking for another example on how to use the alpha package: GameBased/mystery-island#20

@iNewmanity
Copy link

iNewmanity commented Apr 13, 2023

In the meantime i got this fixed but now have another problem: It wont build with the dotnet build command, with it saying error NU1102: Unable to find package MonoGame.Extended with version (>= 3.9.0-alpha0093)

@purrplingcat
Copy link

use 3.9.0-alpha doesn't work, because MGCB sas TiledMapImporter is invalid. If I look to the list of importers, there is none importer from Monogame extended.

@quentinmrzt
Copy link

Thanks a lot for your help; Helped me add the Alpha Package, but i still got issues. Now the MGCB-Editor shows System.NotSupportedException. Any hint where I can find a solution to that :)

Hi, I'm a little late, but I had the same problem and I found the solution! By looking at the error in the code, I understood that it was the presence of 'chunks' that was causing the issue. 'Chunks' are divisions made in your .tmx file to handle large maps. Your map is probably set to 'infinite'; try exporting it with a fixed size, and that should solve your problem!

@wiredmatt
Copy link

For anyone looking for another example on how to use the alpha package: GameBased/mystery-island#20

Using that exact config worked perfectly.

<ItemGroup>
    <PackageReference Include="MonoGame.Extended" Version="3.9.0-alpha0093" />
    <PackageReference Include="MonoGame.Extended.Collisions" Version="3.9.0-alpha0093" />
    <PackageReference Include="MonoGame.Extended.Content.Pipeline" Version="3.9.0-alpha0093" />
    <PackageReference Include="MonoGame.Extended.Input" Version="3.9.0-alpha0093" />
    <PackageReference Include="MonoGame.Extended.Tiled" Version="3.9.0-alpha0093" />
    <PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
    <PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" />
  </ItemGroup>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests