Bug 46738 - Net-Standard: CodeGeneratedAttribute could not be found
Summary: Net-Standard: CodeGeneratedAttribute could not be found
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
Depends on:
Reported: 2016-11-10 16:55 UTC by Chase Florell
Modified: 2017-03-27 22:58 UTC (History)
2 users (show)

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

screenshot (203.64 KB, image/png)
2016-11-10 16:55 UTC, Chase Florell
repro project (4.78 KB, application/x-zip-compressed)
2017-03-27 22:57 UTC, Jimmy [MSFT]

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 or GitHub 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:

Description Chase Florell 2016-11-10 16:55:40 UTC
Created attachment 18416 [details]

So I just spun up a brand new Forms project, and set the PCL to .NETStandard1.5. I then uninstalled all the nuget packages and reinstalled forms, along with the recommended Compatibility bits.

In trying to build the project, I get errors about not being able to find the CodeGeneratedAttribute class, and a suggestion to bring in System.Diagnostics.Tools as that's where the namespace is forwarded to.

I've done exactly that, but still get the same error.

I do have a really hackey workaround that allows me to continue running the app, but obviously not ideal. I simply add this class to the project.

namespace System.CodeDom.Compiler
    internal class GeneratedCodeAttribute 
        : Attribute
        public GeneratedCodeAttribute(
            string foo, 
            string bar)
        { }

For reference, here's my project.json

  "supports": {},
  "dependencies": {
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
    "NETStandard.Library": "1.6.0",
    "System.Diagnostics.Tools": "4.0.1",
    "Xamarin.Forms": ""
  "frameworks": {
    "netstandard1.5": {
      "imports": "portable-net45+win8+wpa81+wp8"
Comment 1 Jimmy [MSFT] 2017-03-27 22:57:56 UTC
Created attachment 20921 [details]
repro project

I was able to reproduce this in VS2015 with the project I'm attaching before updating the Microsoft .NET Core Tools for VS2015. After updating to

> Microsoft .NET Core Tools (Preview 2) 14.1.21111.0

I can now build the project successfully, so this appears to have been an upstream fix.

### Full version information

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA031
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.

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

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

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

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

Application Insights Tools for Visual Studio Package   7.18.00214.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1   14.1.21111.0
ASP.NET and Web Tools 2015.1

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

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

Azure App Service Tools v2.8.1   14.0.11123.0
Azure App Service Tools v2.8.1

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

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

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Merq   1.1.14-alpha (21c13c9)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft .NET Core Tools (Preview 2)   14.1.21111.0
Microsoft .NET Core Tools (Preview 2)

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

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

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

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   14.0.25527.01
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.

Xamarin (4d2ed3d)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (3a62f1e)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS (ba11e48)
Visual Studio extension to enable development for Xamarin.iOS.