Home Dashboard Directory Help
Search

Silverlight 4 Application project, remove reference to mscorlib or System.Core and they can't be readded by jimlizardking


Status: 

Closed
 as External Help for as External


17
1
Sign in
to vote
Type: Bug
ID: 519214
Opened: 12/9/2009 2:44:23 AM
Access Restriction: Public
1
Workaround(s)
view
8
User(s) can reproduce this bug

Description

Removing certain referenced assemblies from a Silverlight 4 Application project in Visual Studio 2010 means they can't be readded and therefore the project will never compile.

It seems that if you remove the reference to mscorlib or System.Core (may be others too?), which Visual Studio processes just fine, if you then try to readd the references, they do not reappear as references. There is no visible error, they just aren't referenced by the project.

As a consequence the error "Predefined type 'System.Object' is not defined or imported" is reported by the compiler. This can only be resolved by adding the reference by manually editing the csproj file: closing/reopening/refreshing/cleaning the project doesn't seem to have any effect.

Details
Sign in to post a comment.
Posted by RandallFlagg on 11/10/2010 at 6:22 PM
Confirm RTM and XNA for WP7
Posted by Dan Billingsley on 6/28/2010 at 10:50 AM
Still exists in RTM!!
Posted by rockin_moroccan on 5/27/2010 at 7:24 AM
I encountered the same problem in VS 2010 Professional RTMRel.
Posted by ecofriend on 3/22/2010 at 4:43 PM
I have encountered the same problem in VS Visual Web Developer 2010 Beta.
Posted by Microsoft on 2/18/2010 at 11:08 PM
This is a known issue that we will not be able to fix for VS2010. The workaround, once in this situation, is to edit the project file and manually re-add the reference
Posted by Microsoft on 12/9/2009 at 6:53 PM
Thank you for your feedback, We are currently reviewing the issue you have submitted.
Sign in to post a workaround.
Posted by jimlizardking on 12/9/2009 at 2:52 AM
As I said in the bug report, one workaround is to manually add the reference back into the project manually by editing the csproj file using (for example) notepad:

Find this section in the csproj file - obviously if you have different/additional references that's what you're looking for:

<ItemGroup>
    <Reference Include="System.Windows" />
    <Reference Include="system" />
    <Reference Include="System.Net" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Windows.Browser" />
</ItemGroup>

Add a line for each of the missing references - in this case, mscorlib and System.Core - and your csproj file should now look something like this:

<ItemGroup>
    <Reference Include="mscorlib" />
    <Reference Include="System.Core" />
    <Reference Include="System.Windows" />
    <Reference Include="system" />
    <Reference Include="System.Net" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Windows.Browser" />
</ItemGroup>