Search

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

Closed
as External Help for as External

15
1
Sign in
to vote
Type: Bug
ID: 519214
Opened: 12/9/2009 2:44:23 AM
Access Restriction: Public
1
Workaround(s)
8
User(s) can reproduce this bug
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 (expand)

Product Language

English

Version

Silverlight 4 Beta

Operating System

Windows 7

Operating System Language

English (UK)

Steps to Reproduce

1. Create Silverlight 4 Application project in Visual Studio 2010 Beta 2.
2. Using the Solution Explorer, remove the references to mscorlib and System.Core.
3. Using the Solution Explorer, right click on 'References' and select 'Add Reference...'
4. Select mscorlib and/or Windows.Core from the .NET tab on the dialog and click OK.
5. Compile the project.
6. Receive error "Predefined type 'System.Object' is not defined or imported"

Actual Results

Project will no longer compile due to lack of reference to mscorlib and System.Core assemblies.

Have to manually edit the csproj file to add the references back in to compile project.

Expected Results

When re-adding the missing assemblies, mscorlib and System.Core, I would expect them to actually be added to the list of references which would allow compilation.
      You can indicate your satisfaction with how Microsoft handled this issue by completing this quick 3 question survey. [Details]

 

File Attachments
0 attachments
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 James Wightman 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>