.NET Framework Bookmark and Share   
 index > MSBuild > problem when using DependentUpon with more embedded resources on the same target
 

problem when using DependentUpon with more embedded resources on the same target

hi all, i'm using vs 2005 and the framework 2.0.

in a web controls dll i have a server control MyControl.cs and 2 embedded files MyControl.js and MyControl.css (all in the same directory).

for having a simpler project i want to hide the 2 resource files so i hack the .proj file and i add the node <DependentUpon>MyControl.cs</DependentUpon>.

In vs all is ok but if i try to compile (with vs) i get the error:
Error 16 The item "obj\Debug\MyControl" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.

the problem is that in the directory obj/Debug seems that the dependent items are put without the extension (ie if i use only the js file i had a file MyControl with the tag DependentUpon or MyControl.js otherwise) so using 2 file with different extension will give an error becouse msbuild will try to save 2 different files to the same destination (the file witout extension).

samebody can help me?

thanks
korkless
Hi Korkless,

Based on my research,thisissue is not related to the same namewith different extension. I havetried to test with different file name, and this issue still appears. Based on my understanding,DependentUpon seems to change the name of the embedded resource, so in the compiled assembly the name is no longer 'MyControl.js' or'MyControl.css'butboth are'MyControl', so it will cause duplicate error.

I would suggest you use other method to achieve your objective, andI don't know why you want to hide these two files in 'MyControl.cs', I think it does not make sense.

If I misunderstood you, or you have any questions, please let me know.

Best Regards,
Nancy
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Nancy Shao

You can use google to search for other answers

Custom Search

More Threads

• Failed to register Post Build Operation Regsvr32
• Call the same target multiple time
• How to re-direct execution path to different target on Successful execution of a task?
• Feature Request: Condition Attribute on ItemMetaData Element
• Accessing the CData section of an Item
• "Build All" While Taking Advantage of Dependency Analysis and BuildInParallel
• MSBuild -> About screen
• Unable to get installer types
• MSBuild : Building .proj files from C# code without calling msbuild from command line
• Change the dependencies with MSBuild.