views:

119

answers:

1

We're currently evaluating VS2010 and have upgraded our VS2008 C++/CLI project to the new .vcxproj format. I've noticed that a certain property we had set in the project settings did not get translated properly. Under Configuration Properties -> Managed Resources -> Resource Logical Name, we used to have (in VS2008) the setting:

$(IntDir)\$(RootNamespace).$(InputName).resources

which indicated that all .resx files were to compile into

OurLib.SomeForm.resources

inside of the assembly. (the Debug portion is dropped when assembled)

According to MSDN, the $(InputName) macro no longer exists and should be replaced with %(Filename). However, when translating the above line to swap those macros, it does not seem to ever expand. The second .resx file it tries to compile, I get a "LINK : fatal error LNK1316: duplicate managed resource name 'Debug\OurLib.%(Filename).resources". This indicates to me that the % style macros are not being expanded here, at least in this specific property.

If we don't set anything in that property, the default behavior seems to be to add the subdirectory as a prefix, such as:

OurLib.Forms.SomeForm.resources

where Forms is the subdir of our project that the .resx file lives. This only occurs when the .resx file is in an immediate subdirectory of the project being built. If a .resx file exists somewhere else on disk (aka ..\OtherLib\Forms\SomeForm2.resx) this prefix is NOT added.

This is causing an issue with loading form resources, as it does not account for this possible prefix, even though we are using the standard Forms Designer method of getting at resources:

System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(SomeForm::typeid));

and do not specify the .resources file by name.

The issue I've just described may not be the same as the original question, but if I were to fix the Resource Logical Name issue I think this would all go away. Does anyone have any information about these % macros and where they are allowed to be used?

A: 

Did you find a resolution to this issue? We are having a similar issue. We are trying to migrate from VS 2005 to VS 2010. We have controls in namespace that is separate from the primary project's namespace. They are phically stored in a seperate directory. The compile succeeds, but loading any screen using a control from the non-primary namespace causes an error. The error says "Could not find any resources appropriate for the specified or neutral culture. Make sure "Secondary.FormName.resources" was correctly embedded or linked...." I can't get the solution to create "Secondary.FormName.resources" files. It wants to make "Primary.FormName.resources" files.

Thanks.

mkw
Check my comment after my initial question - it seems you have to do it for each individual .resx file.
Dave Foster