Bug 32622 - Creating VS2013 project and opening in 2015 causes error CS0012 (Assembly reference issues, including bcl)
Summary: Creating VS2013 project and opening in 2015 causes error CS0012 (Assembly ref...
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General ()
Version: 3.11 (C5)
Hardware: PC Windows
: High normal
Target Milestone: 4.0.0 (C6)
Assignee: Bugzilla
URL:
: 32439 ()
Depends on:
Blocks: 28822
  Show dependency tree
 
Reported: 2015-07-30 13:15 UTC by Jon Davis
Modified: 2016-01-12 19:26 UTC (History)
18 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Repro project, log, and screenshot. (1.75 MB, application/zip)
2015-07-30 13:15 UTC, Jon Davis
Details
Modified targets files for workaround (25.17 KB, application/zip)
2015-08-03 16:19 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Jon Davis 2015-07-30 13:15:06 UTC
Created attachment 12300 [details]
Repro project, log, and screenshot.

You can reproduce the errors for a Xamarin.iOS project. The newly created Xamarin.Droid project works fine here, too..
I’ve attached a zip file. In there’s the solution, and additionally a screenshot
and more importantly the version info of the Visual Studio 2013 instance we created the errors with.

How to reproduce:

1) Create new solution with Visual Studio 2013 (see vs2013info.txt)
2) Create a PCL project (Core)
3) Create Droid project
4) Create iOS project
5) Add MvvmCross to all projects (maybe unnecessary)
6) Configure iOS and Droid project for MvvmCross (maybe unnecessary)
7) Add project references to Test.Core to Test.iOS and Test.Droid
8) Save and commit everything
9) Reopen everything on a different machine with VS2015
10) Watch the IntelliSense errors enfold
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2015-07-31 12:11:38 UTC
## Transcribed error messages from the screenshot in the attachment from comment 0, to improve bug searchability

The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Linq.Expressions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

The type 'Func<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-03 16:19:35 UTC
Created attachment 12343 [details]
Modified targets files for workaround

## Workaround

1. (Optional) Open "Setup.cs" from the Test.iOS project (from comment 0), add a class that implements `IMvxNotifyPropertyChanged` and `INotifyPropertyChanged`, and use the "Quick Actions" to implement the interfaces.
> public class Class1 : IMvxNotifyPropertyChanged, INotifyPropertyChanged



2. Overwrite the existing targets files with the attached modified files (you can optionally diff the files before copying them to see the small change that has been made):

- C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets

- C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets



3. Delete the hidden `.vs` folder in the solution directory.



4. Delete all of the `obj` and `bin` folders from each of the project directories.



5. Open "Setup.cs" from the Test.iOS project and wait a few moments fro the Intellisense processing to complete.




## Results

No Intellisense errors appear.




## Results if you _skip_ step 2 or repeat steps 2-5, but replace the targets files with their original versions

The Intellisense errors appear as originally reported.

> Error	CS0012	The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.	
> Error	CS0012	The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.	
> Error	CS0012	The type 'INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.	
> Error	CS0012	The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Linq.Expressions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.	
> Error	CS0012	The type 'PropertyChangedEventArgs' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.	
> Error	CS0012	The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.	
> Error	CS0012	The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.	
> Error	CS0012	The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.	




## Version info (brief) 

### Windows 8.1 (64-bit) in VMWare Fusion 6.0.6

Microsoft Visual Studio Professional 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00081

Xamarin   3.11.816.0 (cefca47)
Xamarin.Android   5.1.5.2 (2e8568c9f3a3ce0b66203412a268b39618824338)
Xamarin.iOS   8.10.4.0 (099f94bba4532201864249a9064bf73be56f8667)
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-03 16:22:44 UTC
The modified `.targets` files from comment 4 are taken directly from non-public Bug 32425, so I am both verifying that fix and verifying that this bug is a duplicate of Bug 32425.
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-03 16:52:22 UTC
I have now also verified that the "good" behavior as described in Comment 4 also occurs in the latest build of XamarinVS from master.


## Verification status: fixed in master/7984c9e

GOOD: Xamarin   5.1.323.0  (7984c9e)
BAD:  Xamarin   3.11.816.0 (cefca47)




## Additional version info (brief)

### Windows 8.1 (64-bit) in VMWare Fusion 6.0.6

Microsoft Visual Studio Professional 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00081
Comment 7 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-03 18:31:00 UTC
## Small refinement on the Workaround from comment 4

At least for the precise test case from comment 0, step 4 is unnecessary. It is sufficient to delete just the `.vs` folder.

(Note: Deleting the `.vs` folder is both sufficient and _required_. Deleting only the `obj` and `bin` folders is _not_ sufficient.)
Comment 8 Boris Spinner 2015-08-04 01:46:27 UTC
@Brendan: Regarding comment 7, that's actually what I tried before contacting support... :)
Unfortunately it didn't help with our real projects. All I noticed were updated paths in Common Properties/Debug Source Files of the solution.
Just tried it again with a real project and: no difference. Just waited a moment and all errors were back.

But the workaround from comment 4 does indeed relive the pain. Thanks!
Comment 9 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-04 11:58:36 UTC
Comment 7 is a _refinement_ on Comment 4, not a replacement. I included Comment 7 on the bug report mostly to save a little time in helping the Xamarin engineers narrow down the additional change needed after replacing the targets files. Comment 7 is saying that you must complete all the steps from Comment 4, except that you can skip step 4.
Comment 10 Kashif Shaikh 2015-08-05 11:03:19 UTC
I had the same Intellisense problem with VS2015 and MvvmCross with similar project structure. Except I just had to do Step 3 and 4 - delete the .vs directories and copy the new target files.
Comment 11 Kashif Shaikh 2015-08-05 11:04:37 UTC
[forgot to add]

...and problem is now fixed.
Comment 12 Brendan Zagaeski (Xamarin Team, assistant) 2015-08-11 17:50:16 UTC
*** Bug 32439 has been marked as a duplicate of this bug. ***
Comment 14 Jon Goldberger [MSFT] 2015-08-27 17:20:37 UTC
It seems some have not released they need to show hidden items to see and delete the .vs folder for the workaround. To show hidden files/folders:

in File Explorer select the View tab in the ribbon and then place a check next to "Hidden Items". Then you should be able to see the .vs folder and delete it.
Comment 15 Oleg 2015-09-18 02:05:08 UTC
I'm using latest stable Xamarin for VS 3.11.894 and still experiencing this issue. I performed deletion of .vs folder (don't actually get the idea because it is empty in my case), but I still have to copy modified *.targets for it to resolve. Could you incorporate this modified *.targets into install package? It is no good to do this manipulations after every install/update.
Comment 16 Oleg 2015-09-18 02:18:09 UTC
Moreover in attached Android.targets I had to revert other changes and leave only ones after PCL Support comment. Otherwise the intellisense was broken even worse.
Comment 17 Brendan Zagaeski (Xamarin Team, assistant) 2015-09-18 12:36:16 UTC
Reopening against Xamarin.Android specifically. The change to fix this is now included in the `Xamarin.iOS.Common.targets` as of XamarinVS 3.11.1443 (39031d31) (and Xamarin.iOS 9.0.1.18 (d230615) on Mac) (though it was indeed missing in Cycle 5 SR 4, contrary to non-public Comment 2).

But the fix is still _missing_ from the `Xamarin.Android.Common.targets` as of:

- Xamarin.Android 5.1.6.7 (58099c5) on Mac
- XamarinVS 3.11.1443 (39031d31) on Windows
Comment 21 Boris Spinner 2015-10-06 05:16:18 UTC
Having to patch the file manually after every update is really annoying... Still waiting for this to be fixed. When will the fix be included?
Comment 22 Brendan Zagaeski (Xamarin Team, assistant) 2015-10-06 11:29:24 UTC
The change is included in the current Alpha version of Xamarin.Android.

I will accordingly mark the bug as "resolved fixed" against the XamarinVS 4.0 target milestone.
Comment 23 Danish Akhtar 2015-10-14 02:47:56 UTC
I have checked this issue with latest C6 XVS builds, now this issue is not exists. Attached project is opened successfully with VS 2015, without any Intellisense error.

Hence closing this issue.

Environment info:
Microsoft Visual Studio Enterprise 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00081

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA595
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

LightSwitch for Visual Studio 2015   00322-80000-00000-AA595
Microsoft LightSwitch for Visual Studio 2015

Visual Basic 2015   00322-80000-00000-AA595
Microsoft Visual Basic 2015

Visual C# 2015   00322-80000-00000-AA595
Microsoft Visual C# 2015

Visual C++ 2015   00322-80000-00000-AA595
Microsoft Visual C++ 2015

Visual F# 2015 RC   00322-80000-00000-AA595
Microsoft Visual F# 2015 RC

Windows Phone SDK 8.0 - ENU   00322-80000-00000-AA595
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   14.0.20626.0
ASP.NET and Web Tools

ASP.NET Web Frameworks and Tools 2013   5.2.30624.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.5
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GenerateUnitTest   1.0
Generates unit test code for methods in classes under test.

GitHub.VisualStudio   1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft Code Digger   0.9
Microsoft Code Digger

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft.Pex.VisualStudio   1.0
Pex

NuGet Package Manager   3.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2015 ENU   14.0.23025
Microsoft Office Developer Tools for Visual Studio 2015 ENU

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Python Tools for Visual Studio   2.2.30718.00
Python Tools for Visual Studio provides IntelliSense, projects, templates, Interactive windows, and other support for Python developers.

Python Tools for Visual Studio - Django Integration   2.2.30718.00
Provides templates and integration for the Django web framework.

Python Tools for Visual Studio - Profiling Support   2.2.30718.00
Profiling support for Python projects.

SQL Server Data Tools   14.0.50616.0
Microsoft SQL Server Data Tools

Visual C++ for Cross Platform Mobile Development   1.0
Visual C++ for Cross Platform Mobile Development

Visual C++ for Cross Platform Mobile Development   1.0
Visual C++ for Cross Platform Mobile Development

Visual Studio Tools for Universal Windows Apps   14.0.23121.00 D14OOB
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   4.0.0.1582 (41e70e4)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.0.0.13 (4f0d1e9)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   9.2.0.88 (5294365)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 24 Sean Hoffman 2015-12-04 22:43:23 UTC
So i just upgraded my windows computer to windows 10 and installed visual studio 2015. I started up my project that was created in windows 7 with Visual Studio 2013. I am not getting 227 errors all related to missing System.ObjectModel and System.Runtime. THe project still complies and runs fine though. It would appear to be related to this bug. I see that this bug should have been fixed in Xamarin 4.0. Any idea why it is not working for my project?

Here is environment info's.

Microsoft Visual Studio Enterprise 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.01038

Installed Version: Enterprise

Architecture and Modeling Tools   00322-90000-20361-AA528
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

LightSwitch for Visual Studio 2015   00322-90000-20361-AA528
Microsoft LightSwitch for Visual Studio 2015

Visual Basic 2015   00322-90000-20361-AA528
Microsoft Visual Basic 2015

Visual C# 2015   00322-90000-20361-AA528
Microsoft Visual C# 2015

Visual C++ 2015   00322-90000-20361-AA528
Microsoft Visual C++ 2015

Visual F# 2015 RC   00322-90000-20361-AA528
Microsoft Visual F# 2015 RC

Windows Phone SDK 8.0 - ENU   00322-90000-20361-AA528
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   14.0.20626.0
ASP.NET and Web Tools

ASP.NET Web Frameworks and Tools 2013   5.2.30624.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.5
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GenerateUnitTest   1.0
Generates unit test code for methods in classes under test.

JetBrains ReSharper Ultimate 10.0.1   Build 104.0.20151114.160203
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2015 JetBrains, Inc.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft Code Digger   0.9
Microsoft Code Digger

Microsoft.Pex.VisualStudio   1.0
Pex

NuGet Package Manager   3.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2015 ENU   14.0.23025
Microsoft Office Developer Tools for Visual Studio 2015 ENU

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.50616.0
Microsoft SQL Server Data Tools

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   4.0.0.1697 (deffc90)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.0.0.34 (3efa14c)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   9.2.1.51 (3c0ec35)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 25 Sean Hoffman 2016-01-12 15:08:05 UTC
I ma still having this issue. Anyone got any ideas on how to fix it? It is very annoying to work on a project that has 80+ errors in it all the time.

I have tried manually adding the system.objectmodel and system.runtime to the project. This made the warning go away but I still get the errors.

Any ideas??

Thanks,
Sean
Comment 26 Brendan Zagaeski (Xamarin Team, assistant) 2016-01-12 19:26:20 UTC
@Sean, please contact Xamarin support [1] for one-on-one troubleshooting assistance about for your particular environment. Thanks in advance.

[1] "Business & Enterprise Support" on https://xamarin.com/support