Multi platform solution - There is already a link to the same file

I have a simple multi platform solution as test and I get 3 warnings which I want to get rid of. How to I fix these?

Severity    Code    Description    Project    File    Line    Suppression State
Warning        The file 'C:\MG\MultiPlatformTestMG\MultiPlatformTestMG.Shared\Content\Content.mgcb' could not be added to the project.  There is already a link to 'C:\MG\MultiPlatformTestMG\MultiPlatformTestMG.Shared\Content\Content.mgcb'. A project cannot have more than one link to the same file.
Severity    Code    Description    Project    File    Line    Suppression State
Warning        The file 'C:\MG\MultiPlatformTestMG\MultiPlatformTestMG.Shared\Content\Content.mgcb' could not be added to the project.  There is already a link to 'C:\MG\MultiPlatformTestMG\MultiPlatformTestMG.Shared\Content\Content.mgcb'. A project cannot have more than one link to the same file.    MultiPlatformTestMG.Linux
Severity    Code    Description    Project    File    Line    Suppression State
Warning        The file 'C:\MG\MultiPlatformTestMG\MultiPlatformTestMG.Shared\Content\Content.mgcb' could not be added to the project.  There is already a link to 'C:\MG\MultiPlatformTestMG\MultiPlatformTestMG.Shared\Content\Content.mgcb'. A project cannot have more than one link to the same file.    MultiPlatformTestMG.Windows

I just ignore them tbh, tho they do irritate me at times. I find they come and go, I’m not currently getting these warnings.

Yeah thought about it but then I have like 6 warnings now and they quickly pile up and I feel it does not getting better over time :joy:
So I would at least like to have a warning free solution in the beginning. Can’t be that hard I mean must have something to do with how shared projects work I guess?

Have you tried cleaning the solution? Also try manually deleting obj and bin folders in all the individual projects. I seem to remember often seeing it when doing a fresh checkout and those kinda situations.

Yes already tried it several times. Actually what does work is if I exclude the Content.mgcb from the shared project but I want it to be theree of course for easier access if I actually want to add more content. The “build action” as you can see on the screenshot is on “none”. Should be on “MonoGameContentRefrence” or not? But then again there is no such entry available as you can see. Why? How to get it in there?

Oh strange. Well if your targeting multiple platforms there should be no need for the content.mgcb in shared, as you will build your assets per platform? if it works for you just remove it.

I have no experience in developing for multiple platforms so far. So I thought I would first try to reuse all content as I plan to first start with a 2D project. Priority is Android to get some experience for mobile. But then again I thought well its MonoGame why not try to target more platforms?

I am sure it has to do with the targets file

``` where the MonoGameContentReference build action is defined which is for some reason only accepted by normal MonoGame platform projects. But I have no idea why it does not work for the shared project. Check this post in this older thread here: 
[http://community.monogame.net/t/content-in-shared-project/8791/2?u=kwyrky](http://community.monogame.net/t/content-in-shared-project/8791/2?u=kwyrky) 
I tried that with no success. So as I said I can exclude the Content.mgcb file from the shared project and I can in fact load content defined in there for some reason it does work regardless if it is included or not in the solution.  
What is also confusing for testing this is that I can include the Content.mgcb and I dont have any warnings at all. Also no warnings after clean solution, rebuild solution, compiling etc. Only after closing and reopening Visual Studio they do appear again but again only if the Content.mgcb was added before closing.

So this is version 3.7.1.189. Should be tested maybe with the latest dev. Maybe this got fixed already?

I am having this same issue with MonoGame 3.8.0.1641.

I have the following setup:

  • A MonoGame shared project where the content.mgcb is referenced
  • A Windows Desktop Project where I deleted the Content.mgcb file / reference.
  • A Windows Universal Core App project where I also deleted the Content.mgcb file.

I am receiving the following error:
Warning` The file … Content.mgcb could not be added to the project. There is already a link to … Content.mgcb. A project cannot have more than one link to the same file

The warning is emitting from the Windows Universal Core project (which was the second of the two compile-able projects I added).

There are no obvious links to content.mgcb in the project files. Is there a workaround to remove the warning or am I misusing MonoGame content.mgcb in my project setup?

-Brett