Tech blog

Solving problems

About
Contact

Archive for the ‘error’ tag

The custom tool ‘MSLinqToSQLGenerator’ failed. Could not retrieve the current project.

leave a comment

To correct this, open up the Visual Studio 2008 command prompt (or any command prompt and navigate to the location of the VS exe ‘devenv.exe’) and type the following command:

devenv /ResetSkipPkgs

Then open your LinqToSql file(s) (*.dbml) and save to trigger the code generator tool.  After that, you should hopefully be up and running once more.

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Written by Avivo

September 4th, 2009 at 3:30 pm

Silverlight 2.0 – Resolved issue: InitializeError #2103 – Invalid or malformed application

one comment

Intro

I am working on a project that includes ASP .NET MVC web site and Silverlight 2.0 application. Initialy a Visual Studio solution with both project types has been created. At the beginning, sample Silverlight application worked fine, then most of the time development was going on MVC side. Now, when development should continue on Silverlight side browser throws an error:

This blog post explains how the issue has been solved. Resolving issue step by step…

1.Check namespaces

App.xaml should have x:Class attributes formatted as “Namespace.ClassName” (e.g. “StudioBikini.ClientSide.App”).

Same namespace and class name should also appear in App.xaml.cs. Note that namespace and class name are separated in C# file while glued together in XAML.

2. Change project properties

When you change a namespace for App in either C# or XAML the Startup object value in properties still holds the previous value.
Right click on a project in Visual Studio and select Properties.
Click on the Startup object combobox should open a list of available startup object and select the Namespace.ClassName.

Also make sure that Generate Silverlight manifest file checkbox is checked and an existing manifest file is selected.

3. Check manifest file

Some text editors add 3 garbage bytes at the beginning of a file which represent encoding. Those three bytes are invisible by some editors and may cause xml parsing exception.
Remove Properties\AppManifest.xml file and create it again.

4. Other possibilities:

  • Try to set assembly name and default namespace in the project properties to the same value. Namespace in properties should be the same as namespace in App.
  • Try with relative or absolute uri or false uri – if .xap file cannot be found Silverlight plug-in returns error #2104, that is different than #2103. So #2103 indicates that file has been found.
  • Clear browser’s cache (downloaded data) and reload the page with Silverlight.
  • Turn off virus scanner, as some scanners block loading unknown or hidden extensions (I had problems with .xaml.js for Silverlight 1.0).
  • If you are using object tag in html to load .xap file, try to change height in pixels (in case it works on IE7 but not in Firefox 3.0).
  • There may be an old .xap build. Try to rebuild VS solution or delete bin and obj folders from all projects – those folders are generated again on next build.
  • AppManifest.xml file can be read-only, usually happens when under a source control system (e.g. sourcesafe, svn), so check it out first.
  • Finally, delete AppManifest.xml, create new one and paste next lines into the file:

<Deployment xmlns=”http://schemas.microsoft.com/client/2007/deployment”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>

Solution

It appears that file was under Visual SourceSafe, problem with locked file. Solution has been found progressively, step by step as described above.

Another time, another project, same error. Problem with an included assembly reference – a Silverlight Class Library project with web service reference and Silverlight Application project with reference System.ServiceModel… Resolved by commeting code that uses System.ServiceModel (code when calling web service generated classes). Alternative is to use  release settings instead of debug.

Any other suggestions?

VN:F [1.9.3_1094]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Written by Avivo

June 29th, 2009 at 9:59 am