title: Moving from VS 2010 to 2015, C++/CLI class denoted with [Extension] fails to build, error C2337: 'Extension' : attribute not found
body: <p>In the header file, Encrypt.h, I have the following:</p>
  
  <pre><code>#pragma once
  
  using namespace System;
  
  namespace NSpace
  {
      namespace Encryption
      {
          [System::Runtime::CompilerServices::Extension]
          public ref class EncryptionExtensions abstract sealed
          {
          public:
              [System::Runtime::CompilerServices::Extension]
              static String^ ExtractEncrypt(String^ value, int length)
              {
                  return value-&gt;Substring(0, length);
              }
          };
      }
  }
  </code></pre>
  
  <p>In a VS 2015 project that I set up for testing, this builds without errors or warnings. In my original project, ported from VS 2010, above will not build:
  error C2337: 'Extension' : attribute not found
  error C2337: 'Extension' : attribute not found
  error C2337: 'Extension' : attribute not found
  error C2337: 'Extension' : attribute not found</p>
  
  <p>Note two errors for each offending use of [Extension].</p>
  
  <p>The project is C++/CLI (Properties->General->Common Language Runtime Support is set (/clr)). The Platform Toolset is Windows7.1SDK - the test project started out with "Visual Studio 2015 (v140)", but I changed it to emulate the failing project, and it didn't make any difference in the test project, it still builds.</p>
  
  <p>The project Properties->C/C++->General->Common Language Runtime Support is also set (/clr).</p>
  
  <p>The original build environment is VS 2010, version 10.0.40219.1 SP1Rel. The original and ported projects are both targeting .Net 4.0 (for C# projects).</p>
  
  <p>Any ideas why this won't build (in the original project)?</p>