.NET Forum / Visual Studio.NET / IDE / August 2006
Can I strip all code from a VS2005 .sln and just build the resourc
|
|
Thread rating:  |
Allan Michaels - 03 Aug 2006 17:16 GMT Hello all,
Working with a company that specializes in the internationalization and translation of software, I have been requested to provide a 'build structure' so that company can modify resources, build, and return the resource .dlls (e.g. Assemby1.en.dll, Assembly1.de.dll, etc.).
The .resx files associated with Forms and Controls are my main concern. I didn't expect the following to work well, but I tried anyway. (And, yes, they didn't work well). 1) delete the .cs files from the solution from within VS2005. -> that also deleted the .resx file from the solution.
2)deleted all the .cs files from disk leaving only the .resx files. -> Buiding resulted in the error Microsoft.CSharp.targets(63,9): error MSB3041: Unable to create a manifest resource name
I'm going to look into modifying Microsoft.CSharp.Targets (which the file header strongly suggests against.)
I am working in Visual Studio 2005 using CSharp.
Any ideas, suggestions, dire warnings of failure are well appreciated. Thanks in advance for the help.
 Signature Allan Michaels Ann Arbor, MI
Gary Chang[MSFT] - 04 Aug 2006 06:37 GMT Hi Allan,
Based on the description, it seems you want create a resource-only assembly project. If so, I think create a class library project and add the resource file to it, then delete its code file would be OK.
I have performed some tests on my side, the .resx file hadn't been removed when I delete the .cs files. Maybe you takes another approach on this problem, would you please tell me more detailed info about what you tested?
Thanks!
Best regards,
Gary Chang Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Allan Michaels - 04 Aug 2006 17:30 GMT Hello Gary,
Thanks for the reply. Based on your results, I simplified my testing:
1. I created a New Project->Class Library named by default ClassLibrary1. 2. I copied two files 'CxButton.cs' and 'CxButton.resx'. 3. I Added an Existing Item 'CxButton.resx' to the ClassLibrary1 assembly. 4. Only 'CxButton.resx' was added to the assembly.
The .csproj file now contains the lines: <ItemGroup> <EmbeddedResource Include="CxButton.resx"> <SubType>Designer</SubType> </EmbeddedResource> </ItemGroup>
5. I then excluded 'CxButton.resx' from the assembly, closed, saved all changed files and reopened the .sln
The .csproj file now contains no reference to 'CxButton.resx'.
6. I Added an Existing Item 'CxButton.cs' to the ClassLibrary1 assembly. 7. 'CxButton.cs' and 'CxButton.resx' were added to the assembly. In the Solution Explorer, the latter is a sub-node of the former. 8. I closed the project, saving all modified files, and reopened the project.
The .csproj file now contains the lines: <ItemGroup> <Compile Include="Class1.cs" /> <Compile Include="CxButton.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="CxButton.resx"> <DependentUpon>CxButton.cs</DependentUpon> <SubType>Designer</SubType> </EmbeddedResource> </ItemGroup>
9. I then right-clicked the 'CxButton.cs' node and selected Exclude from Project 10. Both the '.cs' and the '.resx' were excluded. I closed, saved, and reopened again.
The .csproj file now contains no reference to 'CxButton.resx'.
11. I then repeated adding the '.resx' file. 12. Both the '.cs' and the '.resx' were added. [Before only the .resx was added.]
The .csproj file now contains the lines exactly as written in step 8 above.
13. I closed the solution, reopened. 14. Whatever I do, the '.cs' and the '.resx' are now inexorably linked.
Where, what, or how is this association being maintained, even after the files have been excluded from the solution??? I think I've eliminated the .csproj because of my observations of that file's content.. Also, the association is not held within the Visual Studio session, because I close and reopen each time.
How do I break this association? I really don't want to go hand-edit all of my .csproj files to eliminate the 'Dependent on' clause within the file. I have hundreds of forms and controls I need to do this to.
There's my situation. Any thoughts?
Thank you very much for your help in this matter.
 Signature Allan Michaels Ann Arbor, MI
> Hi Allan, > [quoted text clipped - 30 lines] > ================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. Gary Chang[MSFT] - 07 Aug 2006 08:10 GMT Hi Allan,
Thansk for your detailed description!
I am not very clear about what you really want to do with the ClassLibrary1 project, do you want to only add the CxButton.resx to that project?
If so, it seems the step 4 has already done this. If I add an existed resource file from other project to a new created class library project, it could be build well.
By the way, the CxButton.cs needs its corresponding resource file CxButton.resx, but the resource file itself has not links to any particular files.
Thanks!
Best regards,
Gary Chang Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Allan Michaels - 07 Aug 2006 14:00 GMT Thanks for the response, Gary.
>I am not very clear about what you really want to do with the ClassLibrary1 >project, I really don't want to do anything with a ClassLibrary1 project. That was an example demonstrating the phenomena I'm encountering in my real project. I would like to, as the subject line says, "...strip all code from a VS2005 .sln".
I can rephrase the question: "Given a project containing a .cs and a .resx dependent upon that .cs, how do I break the 'dependent upon' relationship within the IDE so that I can exclude the .cs from the project without automatically excluding the .resx by association."
I really appreciate the help, Gary. Thank you very much.
 Signature Allan Michaels Ann Arbor, MI
> Hi Allan, > [quoted text clipped - 23 lines] > ================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. Gary Chang[MSFT] - 08 Aug 2006 10:18 GMT Hi Allan,
>I can rephrase the question: "Given a project containing a .cs >and a .resx dependent upon that .cs, how do I break the >'dependent upon' relationship within the IDE so that I can exclude >the .cs from the project without automatically excluding the .resx >by association." Based on my experience, this behavior only happens when you create the resource file with its name as the same as its corresponding .cs file. In this scenario, the VS2005 IDE will add the new resource file as a subitem of that corresponding .cs file. There is no ways to break up this dependency inside VS2005 IDE.
But I suggest you can create the resource file with a stand-alone file name, then you can rename it with the .cs file's name if required. In this scenario, the resource file doesn't have a dependency with that .cs file
Wish this helps!
Best regards,
Gary Chang Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Allan Michaels - 08 Aug 2006 16:39 GMT Thanks for the confirmation that there is no way to break up this dependency inside VS2005 IDE.
I did the following: 1) a 'Find in Files' for 'DependentUpon' in '*.*'. 2) visited every instance found and removed the appropriate line. 3) Opened the .sln. 4) The .cs and .resx files are listed individually 5) I can delete all the .cs files. The .resx remain and build.
It was imperative that I work with the existing .sln rather than try to start from scratch. The existing .sln contains many assemblies, each with their own subfolders and properties, e.g. namespace, output name, post-build events. To recreate each assembly would have been too much error-prone work.
Just as an FYI, this page http://forums.microsoft.com/msdn/showpost.aspx?postid=66418&siteid=1 demonstrates an add-on that actually creates the DependentUpon relationship.
Thanks again for all your help, Gary.
 Signature Allan Michaels Ann Arbor, MI
> Hi Allan, > [quoted text clipped - 26 lines] > ================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. Gary Chang[MSFT] - 09 Aug 2006 03:56 GMT You are welcome, Allan.
I am regret currently there is no quick and easy approaches in your case. I will forward this issue to our corresponding product team for review, we need a better solution in such a scenario.
Thanks for your understanding.
Best regards,
Gary Chang Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|