Link Error LNK1316: duplicate managed resource - by routine

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 534099 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 2/16/2010 6:38:45 PM
Access Restriction Public


Get link error 1316 (duplicate managed resource) when adding an existing Form/Header file and its associated resx file to C++/CLI Windows Forms Application.
Sign in to post a comment.
Posted by Li Shao [MSFT] on 2/22/2010 at 12:05 PM
Thank you for the additional information. I am able to repro your problem. It looks like an issue with project system not removing the extra Form2.resx that you change the form2.h from header type to Winform type.

<EmbeddedResource Include="form2.resx" />
    <EmbeddedResource Include="form2.resx">

You can fix that by manually removing form2.resx from solution explorer.

Since there is an easy workaround, we are not going to fix this for this release but will consider fixing it for future releases.

Again, thank you for your feedback!

Li Shao, Project and Build Team
Posted by routine on 2/22/2010 at 9:13 AM
I have attached a project where this is occurring.

You will need to include the files (Form2.h, Form2.cpp, Form2.resx) to the project.

One thing I forgot to mention after including the files, you must change the file type of Form2.h from 'C++ Header File' to 'C++ Form'.

To do this, click Form2.h file in Solution Explorer and edit the File Type property from the Properties window.

Once you get this error message, you will not be able to re-open the project. It fails.

Btw, I am able to reproduce this reliably:

1. Create a new Windows Forms C++/CLI project.
2. Add a new form: Form2.
3. Add a button to Form2 so it will generate a RESX file.
4. Save.
5. Remove Form2 from project (you will probably get error about disposed object).
6. Exit VS 2010.
7. Open VS 2010 and reopen project
8. Remove last bits of Form2.
9. Right click on all 3 Form2 (header, cpp, resx) files.
10. Click on include in project.
11. Click on Form2.h.
12. Edit properties, change File Type to "C++ Form".
13. Recompile.
Posted by Microsoft on 2/20/2010 at 11:22 PM
We are unable to reproduce this problem at our end. Could you attach the project that reproduces this bug?

Posted by Microsoft on 2/17/2010 at 1:36 AM
Thank you for your feedback, We are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(