Saturday, July 30, 2011

Build action property - WP7:The property could not be read/written because the language service returned an unknown error



The property could not be read/written because the language service returned an unknown error

One of the most frustrating errors I have faced till now while developing app for Windows phone 7(WP7). I didn’t get any proper solution when I googled. So I wanted to share what solution I found for this error.

The story goes like this. I finished my windows phone 7 app – Finance Manager beta(listed in my blog). When i submitted to the App hub it said,

The [NeutralResourceLanguage] attribute is missing on the entry Linkassembly.

Well i was puzzled by this and as every person does I googled. And I got the solution to this problem easily. It was because fortunately many of the people had faced the same problem. I found 2 ways to solve this problem either manually through or using wizards. As a programmer I went for the manual option. The manual solution is to go to assemblyinfo.cs file. This file can be accessed in the solution explorer under the properties section. Then add the following commands.

using System.Resources; //on the top

[assembly: NeutralResourcesLanguage("en")] //In the section where all the attributes are given.

Else you can right click on the properties tab and under the build tab below default namespace. Click on the assembly information. In that under the Neutral language drop down select the language you want.

Normally this should solve the problem.

But unfortunately, my problem did not get solved, I gave the new XAP after adding this tag also, App Hub returned the same error. So I went to the second option of using the wizard. But when I clicked Assembly information all the fields were empty. I was wondering what the problem was. So I decided to manually feed in the values in to the fields. But when I clicked ok, Visual studio threw an error

The property could not be read/written because the language service returned an unknown error

I googled this, but unfortunately no solutions. I had no other choice but to solve the problem myself. So as I looked in to various things in my project settings, properties etc, I did find what the problem was.

There is a property of all the items in the project called Build Action. If this property is set wrong then the functionality of the app will be totally different even if one has done the coding perfectly. When I saw what the Build action property of Assemblyinfo.cs ,it was set to content. It should have been compile. I changed it to compile. Immediately all the fields in Assembly information of the properties of the project were loaded properly(As I described earlier, all the fields were empty but now they were loaded with values ).

Make sure your Build action property for all items is set properly. For example if u set the property of the DLL’s used for Localization should be set to content. If you set it to resource, though DLL have been created properly you will not get the output. So as such, Build action property if not set to the proper value can be really bugging.

2 comments:

Thanx...I encountered the same prob. wen i submitted my app in the apphub...
Thanx for helping me out...

Regards,
Prashanth Ramakrishnan
(Fellow Blogger and Programmer) :P

I was getting this problem and could not run my WP7 game on the emulator, so I did as you suggested and looked at the build action for each object. They seemed correct, but I changed a few of them from Content to Compile, then back to Content, and the program runs.

I'm not quite sure what to think, but at least it works!

Post a Comment