locked
Code Contract Tab Missing RRS feed

  • Question

  • I have installed, reinstalled rebooted etc, etc.  The code contract tab is not present in my c# project properties page.  VS2010 premium 64 bit windows pro.  I also have resharper 6.0 and productivity power tools loaded.   I am unable to use code contracts because of this any suggestion for turning on Static and runtime checking without the property page.

    Thanks Jeff

     
    Wednesday, February 15, 2012 7:57 PM

All replies

  • Hi, 

    What kind of C# project is it?

    Can you repro with a new empty project?  If so, please post the .csproj file's contents and I'll try to repro.

    - Dave


    http://davesexton.com/blog

    • Edited by Dave Sexton Wednesday, February 15, 2012 9:28 PM Grammar
    Wednesday, February 15, 2012 9:27 PM
  • Dave,

    Thanks for such a quick response.  It fails on all project types.  This was a new windows form project with nothing added.

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
        <ProductVersion>8.0.30703</ProductVersion>
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectGuid>{DB4442E2-69EE-4FEF-93D1-6BDB9F60E0C8}</ProjectGuid>
        <OutputType>WinExe</OutputType>
        <AppDesignerFolder>Properties</AppDesignerFolder>
        <RootNamespace>WindowsFormsApplication1</RootNamespace>
        <AssemblyName>WindowsFormsApplication1</AssemblyName>
        <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
        <TargetFrameworkProfile>Client</TargetFrameworkProfile>
        <FileAlignment>512</FileAlignment>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
        <PlatformTarget>x86</PlatformTarget>
        <DebugSymbols>true</DebugSymbols>
        <DebugType>full</DebugType>
        <Optimize>false</Optimize>
        <OutputPath>bin\Debug\</OutputPath>
        <DefineConstants>DEBUG;TRACE</DefineConstants>
        <ErrorReport>prompt</ErrorReport>
        <WarningLevel>4</WarningLevel>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
        <PlatformTarget>x86</PlatformTarget>
        <DebugType>pdbonly</DebugType>
        <Optimize>true</Optimize>
        <OutputPath>bin\Release\</OutputPath>
        <DefineConstants>TRACE</DefineConstants>
        <ErrorReport>prompt</ErrorReport>
        <WarningLevel>4</WarningLevel>
      </PropertyGroup>
      <ItemGroup>
        <Reference Include="System" />
        <Reference Include="System.Core" />
        <Reference Include="System.Xml.Linq" />
        <Reference Include="System.Data.DataSetExtensions" />
        <Reference Include="Microsoft.CSharp" />
        <Reference Include="System.Data" />
        <Reference Include="System.Deployment" />
        <Reference Include="System.Drawing" />
        <Reference Include="System.Windows.Forms" />
        <Reference Include="System.Xml" />
      </ItemGroup>
      <ItemGroup>
        <Compile Include="Form1.cs">
          <SubType>Form</SubType>
        </Compile>
        <Compile Include="Form1.Designer.cs">
          <DependentUpon>Form1.cs</DependentUpon>
        </Compile>
        <Compile Include="Program.cs" />
        <Compile Include="Properties\AssemblyInfo.cs" />
        <EmbeddedResource Include="Properties\Resources.resx">
          <Generator>ResXFileCodeGenerator</Generator>
          <LastGenOutput>Resources.Designer.cs</LastGenOutput>
          <SubType>Designer</SubType>
        </EmbeddedResource>
        <Compile Include="Properties\Resources.Designer.cs">
          <AutoGen>True</AutoGen>
          <DependentUpon>Resources.resx</DependentUpon>
        </Compile>
        <None Include="Properties\Settings.settings">
          <Generator>SettingsSingleFileGenerator</Generator>
          <LastGenOutput>Settings.Designer.cs</LastGenOutput>
        </None>
        <Compile Include="Properties\Settings.Designer.cs">
          <AutoGen>True</AutoGen>
          <DependentUpon>Settings.settings</DependentUpon>
          <DesignTimeSharedInput>True</DesignTimeSharedInput>
        </Compile>
      </ItemGroup>
      <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
      <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
           Other similar extension points exist, see Microsoft.Common.targets.
      <Target Name="BeforeBuild">
      </Target>
      <Target Name="AfterBuild">
      </Target>
      -->
    </Project>

    Thanks Jeff


    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Wednesday, February 15, 2012 9:36 PM
  • Hi Jeff,

    Looks fine, so I can't explain it.  Maybe the CC team will be able to help.

    For now, you can try adding the following element to the first PropertyGroup.  Note that 1 = "Standard Contract Requires", so I assume that the default value is 0.  Check the Contracts User Manual for more info.

    <CodeContractsAssemblyMode>1</CodeContractsAssemblyMode>

    Add the following elements to each of the configuration-specific PropertyGroup elements.  The Properties window edits these elements depending upon the current solution configuration (e.g., Debug or Release).  This should get the CC tools running for you when building.

    <CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking>
    <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface>
    <CodeContractsRuntimeThrowOnFailure>False</CodeContractsRuntimeThrowOnFailure>
    <CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires>
    <CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers>
    <CodeContractsRunCodeAnalysis>True</CodeContractsRunCodeAnalysis>
    <CodeContractsNonNullObligations>True</CodeContractsNonNullObligations>
    <CodeContractsBoundsObligations>True</CodeContractsBoundsObligations>
    <CodeContractsArithmeticObligations>True</CodeContractsArithmeticObligations>
    <CodeContractsEnumObligations>True</CodeContractsEnumObligations>
    <CodeContractsRedundantAssumptions>True</CodeContractsRedundantAssumptions>
    <CodeContractsRunInBackground>True</CodeContractsRunInBackground>
    <CodeContractsShowSquigglies>True</CodeContractsShowSquigglies>
    <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
    <CodeContractsEmitXMLDocs>False</CodeContractsEmitXMLDocs>
    <CodeContractsCustomRewriterAssembly />
    <CodeContractsCustomRewriterClass />
    <CodeContractsLibPaths>
    </CodeContractsLibPaths>
    <CodeContractsExtraRewriteOptions />
    <CodeContractsExtraAnalysisOptions />
    <CodeContractsBaseLineFile />
    <CodeContractsCacheAnalysisResults>True</CodeContractsCacheAnalysisResults>
    <CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
    <CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
    <CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>

    - Dave


    http://davesexton.com/blog

    Wednesday, February 15, 2012 10:05 PM
  • Dave,

    Tried you suggestion above with no success.  The project file loads in the solution ok. - no errors but

    Contract.Requires(document != null"document cannot be null"); is still grayed out with "Method will be skipped ..."

    Thanks Jeff


    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Thursday, February 16, 2012 9:57 PM
  • Hi Jeff,

    Does the output window show anything related to Code Contracts when you build?  You may want to post the entire output here.

    Neither Visual Studio or C# generates that warning, so you must have an extension installed.  Perhaps ReSharper?  Maybe you should try disabling it in case it conflicts with Code Contracts.

    Where is Visual Studio installed on your computer?  For example, mine is here:

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe

    Where is Code Contracts installed on your computer?  Mine is here:

    C:\Program Files (x86)\Microsoft\Contracts\

    Does the following file exist?  If not, then it would seem that Code Contracts isn't installed properly.

    C:\Program Files (x86)\MSBuild\4.0\Microsoft.Common.targets\ImportAfter\CodeContractsAfter.targets

    - Dave


    http://davesexton.com/blog

    Thursday, February 16, 2012 11:57 PM
  • Hi,

    As I posted in another thread I have a similar issue. The tab doesn't show up, my csproj file looks the same, adding the elements to configuration enables static checking upon build. I still however would like the Code Contracts tab to be in the properties and have it work without manually changing the configuration file, because it's really cumbersome and it's not really working as intended.

    Saturday, February 18, 2012 10:00 PM
  • Hi,

    Can you confirm whether your installation paths are the same as the ones that I posted previously?

    Also, can you confirm whether the following registry keys exist on your computer?  I found these on mine and I can see the tab.

    (Note: Exclude the Wow6432Node key if you have a 32 bit OS.)

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CodeTools\CodeContracts\PropertyPages\{1F89CA21-E885-439d-92F5-C36ABE518593}\

    • Default={Empty}
    • category=ConfigPropertyPages
    • clsid={6962fc39-92c8-4e9b-9e3e-4a52d08d1d83}

    Projects\

    • Default={Empty}
    • {FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}=CSharp
    • VisualBasic={Empty}

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Projects\{F184B08F-C81C-45f6-A57F-5ABD9991F28F}\ConfigPropertyPages\{1f89ca21-e885-439d-92f5-c36abe518593}\

    • Default=Microsoft Code Contracts Property Page

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\ConfigPropertyPages\{1f89ca21-e885-439d-92f5-c36abe518593}\

    • Default=Microsoft Code Contracts Property Page

    HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{6962FC39-92C8-4e9b-9E3E-4A52D08D1D83}\InProcServer32\

    • Default=C:\Windows\SysWOW64\mscoree.dll
    • Assembly=CodeContractsVSPropertyPane, Version=1.4.50126.1, Culture=neutral
    • Class=Microsoft.Contracts.VisualStudio.PropertyPane
    • CodeBase=C:\Program Files (x86)\Microsoft\Contracts\Bin\CodeContractsVSPropertyPane.dll
    • ThreadingModel=Both

    Curiously, I also have the following key containing $Installed that pretty much duplicates the first key's subkeys and values, but it seems like a strange name for a key.

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CodeTools\$Installed\CodeContracts

    - Dave


    http://davesexton.com/blog

    Sunday, February 19, 2012 12:54 AM
  • Hi,

    The paths are the same except I'm running Windows XP 32 bit and I have Program Files instead of Program Files (x86).

    The first key's clsid is the same except it's in upper-case.

    The third key is missing.

    The fourth key is there, in upper case again.

    The $installed key is also there.

    Sunday, February 19, 2012 9:48 AM
  • Hi, 

    Exactly which key is missing?

    If it's one of the project keys then that might explain why you aren't seeing a tab; although, it doesn't explain why the installer didn't add the key.

    - Dave


    http://davesexton.com/blog

    Sunday, February 19, 2012 12:23 PM
  • Hi,

    It was this one:

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\ConfigPropertyPages\{1f89ca21-e885-439d-92f5-c36abe518593}\

    • Default=Microsoft Code Contracts Property Page

    I tried to add it manually but unfortunately it didn't help

    Sunday, February 19, 2012 2:41 PM
  • Hi,

    Interesting, that key's for C# projects.  If the key before it containing F184B08F-C81C-45F6-A57F-5ABD9991F28F is in your registry then try creating a VB project just to see if the Code Contracts tab appears.

    If you added the key for C# and it didn't help, did you remember to omit the Wow6432Node key?  Also, did you restart Visual Studio after adding the key?  You may want to try rebooting as well, just in case.

    - Dave


    http://davesexton.com/blog

    • Edited by Dave Sexton Sunday, February 19, 2012 3:27 PM Correction: Node = key
    Sunday, February 19, 2012 3:26 PM
  • Hey,

    Unfortunately creating a new project, restarting VS, rebooting PC, none of that made the tab visible. I did omit the Wow6432Node and still nothing. Just curious, are the keys case-sensitive?

    Sunday, February 19, 2012 3:46 PM
  • Hi,

    It's probably case-insensitive but I don't know for sure.

    Did you try creating a VB project?  If a tab doesn't show up for VB either then the problem is related to more than just the missing C# key (though that would seem to be true anyway based on your tests).

    - Dave


    http://davesexton.com/blog

    Sunday, February 19, 2012 5:12 PM
  • Hi,

    Sorry I've misread VB as VS. I've created a VB project and in fact there is a Code Contracts tab present.

    Sunday, February 19, 2012 5:18 PM
  • Hi Septemptus,

    I'm assuming that you're using the latest installer available here, correct?  Have you installed any older versions of Code Contracts previously?  If so, try uninstalling all versions and then check the install paths and reg keys to make sure they are actually removed.  If they aren't, then I suggest removing them yourself (carefully!).

    Also, if you've used previous releases of Code Contracts, did the Contracts tab ever show up?

    I just looked at the installer in Orca but nothing jumped out at me as an obvious problem.  I did notice that the missing reg key is marked as transitive, but I'm not sure whether that could cause a problem like this.

    - Dave


    http://davesexton.com/blog

    Sunday, February 19, 2012 7:01 PM
  • Hey,

    I have used this installer only. I mentioned in another thread that the only thing that I think may have caused it was installing Code Contracts on Visual C# Express, then installing VS Ultimate on top of it, removing Code Contracts and installing them again. I have never seen the Code Contracts tab in the properties panel of C# projects.

    I'll try uninstalling CC again and look for any rogue registry keys and reinstall, though honestly I'm stripped of any hope at this moment.

    Sunday, February 19, 2012 7:34 PM
  • Hi,

    If you run the .msi with logging enabled, that may help to shed some light on the problem.  For example:

    Contracts.devlab9ts.msi /lv* cc.log

    The first thing I'd do is search for the section where registry entries are installed to see if any reasons are logged for the C# key being omitted.  Here's the associated record from the Registry Table:

    regBFF359B95E28003C67EF0478F5F61943
    2
    Software\Microsoft\VisualStudio\10.0\CodeTools\CodeContracts\PropertyPages\{1F89CA21-E885-439d-92F5-C36ABE518593}\Projects
    {FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}
    CSharp
    VS10PackageRegistryComponent

    - Dave


    http://davesexton.com/blog

    • Edited by Dave Sexton Sunday, February 19, 2012 7:56 PM Formatted
    Sunday, February 19, 2012 7:54 PM
  • Hey Dave,

    This comes from the log about the key you mentioned:

    MSI (s) (C0:20) [12:05:53:812]: Executing op: RegOpenKey(Root=-2147483646,Key=Software\Microsoft\VisualStudio\10.0\CodeTools\CodeContracts\PropertyPages\{1F89CA21-E885-439d-92F5-C36ABE518593}\Projects,,BinaryType=0,)
    MSI (s) (C0:20) [12:05:53:812]: Executing op: RegAddValue(Name={FAE04EC0-301F-11d3-BF4B-00C04F79EFBC},Value=CSharp,)
    WriteRegistryValues: Key: \Software\Microsoft\VisualStudio\10.0\CodeTools\CodeContracts\PropertyPages\{1F89CA21-E885-439d-92F5-C36ABE518593}\Projects, Name: {FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}, Value: CSharp

    I've also looked for any mention of the key that I was missing, it's not in the log.

    I'll be honest though I don't really know what I'm looking for exactly, so if you'd like I can provide the whole registry part of the log.

    Monday, February 20, 2012 11:23 AM
  • The funny thing is, now I do have a Code Contracts tab in my propery pages!

    Though I do not know if that's what caused it, because I believe I have had some visual studio updates going on overnight. So if that was the cause then I am terribly sorry for taking your time, and thank you for all the help!

    Monday, February 20, 2012 11:28 AM
  • Hi,

    I hadn't even considered VS being out of date.  Did you just install SP1 or did you already have it before you reported this issue?

    - Dave


    http://davesexton.com/blog

    Monday, February 20, 2012 12:26 PM
  • I have had SP1, but the updates that installed were ones that followed the SP1 release I think, I remember there were some security updates in the bulk but didn't pay too much attention to it.
    Monday, February 20, 2012 12:51 PM
  • Dave,

    Sorry, been off a couple of days skiing. :)  I tried all the things mentioned above.  I did have two keys missing, which I inserted manually.

    I inserted this key.

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\ConfigPropertyPages\{1f89ca21-e885-439d-92f5-c36abe518593}\

    • Default=Microsoft Code Contracts Property Page

    I also have the $Installed key as well expect my category key was empty.  I set it to ConfigPropertyPages.

    I checked for updates but none were required.

    I uninstalled CC and re-installed

    I disabled all VS Extension and Resharper.  It now appears the Code contracts are being processed. (They are no longer greyed out even after I re-enabled Resharper)  But, I still do not have a CC tab.

    I do have the CC tab on VB projects.

    I have reboot, blah , blah, etc.

    I did have a version of Ultimate installed prior to this installation of Premium.  (it was previously loaded and I realized my MSDN subscription did not give me Ultimate, so I unloaded it and installed premium.)

    Any additional ideas would be appreciated.

    Thanks Jeff


    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Wednesday, February 22, 2012 8:15 PM
  • Hi Jeff,

    After updating your C# project file manually and inserting the elements that I had posted previously, does building the project run the static checker and the rewriter?  Please check the Output window for any information regarding Code Contracts after building.

    - Dave


    http://davesexton.com/blog

    Thursday, February 23, 2012 8:24 AM
  • Dave,

    Yea it seems to be working except for getting the tab to show up.  here is some of the output.

    EnsureContractReferenceAssemblyOfDependeeProjects:

      EnsureContractReferenceAssemblies: C:\DEV4\Templates\Source\Empower.Templates.Messages\bin\Debug\Empower.Templates.Messages.dll;C:\DEV4\Templates\Source\Empower.Templates.Resources\bin\Debug\Empower.Templates.Resources.dll

    C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v4.0\Microsoft.CodeContracts.targets(389,5): warning : Contract reference assembly for project 'Empower.Templates.Messages' not found. Select 'Build' or 'DoNotBuild' for Contract Reference in project settings.

    C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v4.0\Microsoft.CodeContracts.targets(389,5): warning : Contract reference assembly for project 'Empower.Templates.Resources' not found. Select 'Build' or 'DoNotBuild' for Contract Reference in project settings.

    CodeContractRewrite:

      "C:\Program Files (x86)\Microsoft\Contracts\Bin\ccrewrite" "@Empower.Templates.Providersccrewrite.rsp"

    Jeff

    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Thursday, February 23, 2012 1:32 PM
  • Dave,

    So you know, it is difinetely working.  I am using it and really like its capabliilties.  I been building against different options, like suggest and various warning levels.  It has taken me sometime to get my head around everything, but I am really excited about the opportunity it provides for injecting some quality improvements into our development process.  Now we just need the options tab to show up in the properties editor.

    Thanks Jeff


    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Friday, February 24, 2012 4:29 PM
  • Hi Jeff,

    At this point I'm not sure what is causing the problem with the tab not showing up in C# projects.  It seems to be related to missing registry entries, but so far I can't tell why they're missing from just peeking into the installer or examining fragments of installer logs.  As Septemptus mentioned, it may have something to do with having a previous installation of a different edition of Visual Studio; e.g., Express or Ultimate.

    Hopefully the CC team is aware of this issue, or perhaps they can offer further assistance if they need more info from you guys.

    - Dave


    http://davesexton.com/blog

    Friday, February 24, 2012 5:35 PM
  • I'm having the exact same problem.

    At first I experienced it at work, I thought it was because we work on shared machines via RDP or maybe because we have resharper, but then I tried at home too, where I have my own computer, I'm administrator and I don't have resharper, and I had the same problem.

    I was missing that "third" registry key as the post before, and I also have the tab appearing on VB projects but not on C# projects.

    I tried reboot, restart, adding that missing key manually, etc. still not working.

    I remember in the past, with other versions of the toolkit, that the tab was appearing correctly. It must be a bug of the latest version of the toolkit.

    Friday, February 24, 2012 6:26 PM
  • Just to add my "me too" to the conversation. Exactly as described above, except I had Express on my machine beforehand (was uninstalled though). My machine is also 64bit. 

    I have SP1 on the machine, but I'm going to try applying all the service updates I can find. 

    Friday, February 24, 2012 8:22 PM
  • Dave,

    I was looking through the vbproj file to see what some of the settings were when I toggled them since the CC tab was available in my vb projects.  I noticed that the following tags were not in the elements you had me add earlier to my csproj.

        <CodeContractsInferRequires>False</CodeContractsInferRequires>
        <CodeContractsInferEnsures>False</CodeContractsInferEnsures>
        <CodeContractsInferObjectInvariants>False</CodeContractsInferObjectInvariants>
        <CodeContractsSuggestAssumptions>False</CodeContractsSuggestAssumptions>
        <CodeContractsSuggestRequires>True</CodeContractsSuggestRequires>
        <CodeContractsSuggestEnsures>False</CodeContractsSuggestEnsures>
        <CodeContractsSuggestObjectInvariants>False</CodeContractsSuggestObjectInvariants>
        <CodeContractsDisjunctiveRequires>False</CodeContractsDisjunctiveRequires>

    I have added them and now the CC tab is visible.  Unfortunately, my Code Analysis tab is no longer there.

    Jeff


    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Friday, February 24, 2012 8:30 PM
  • Okay, tried the registry hack, but to no avail. I think I'll come back when it's advanced to the Beta software stage...... Sounds interesting if you can actually install it! 
    Friday, February 24, 2012 9:00 PM
  • Hi Jeff,

    I don't have those elements in the project that I copied and posted here because they correspond to new features that were added in the latest release and I haven't updated that particular project yet.  However, the tab shows up for me even without those elements.  So perhaps something else triggered the tab to show besides adding them to your project?

    - Dave


    http://davesexton.com/blog

    Friday, February 24, 2012 11:16 PM
  • Hi Jeff,

    Also, the tab is present for me even with your original project file that doesn't have any CC elements.

    - Dave


    http://davesexton.com/blog

    Friday, February 24, 2012 11:19 PM
  • Dave,

    This is becoming extremely frustrating and unproductive.  Now that the Code Contract tab is available, several other tabs are missing.  I completely uninstalled VS2010, cleaned the registery and reinstalled VS2010.  Still have missing tabs.  How do I recover the tabs that I am missing.

    Thanks Jeff


    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Monday, February 27, 2012 2:37 PM
  • Dave,

    I removed all the registery entries around code contracts and the tabs reappeared.  This is really strange.

    Jeff


    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Monday, February 27, 2012 3:07 PM
  • Dave,

    Re-installed the keys and the CC tab does not appear, but at least my other tabs did not disappear.  Any thoughts?

    Thanks Jeff


    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Monday, February 27, 2012 3:18 PM
  • Hi Jeff,

    The registry keys that I posted were from my personal computer.  I don't know if those keys are correct for your particular environment.  Actually, it seems that they aren't ;)

    - Dave


    http://davesexton.com/blog

    Monday, February 27, 2012 5:10 PM
  • Thanks for this. On my system, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}\ConfigPropertyPages\{1f89ca21-e885-439d-92f5-c36abe518593}\ was also the one that was missing, but on my system, after I added that it initially didn't work, but when I also cleared my user settings (removed HKCU\Software\Microsoft\VisualStudio) and started with fresh settings, it did work. Something less drastic would probably also work, but this is fine for me.

    Monday, February 27, 2012 9:32 PM
  • Sorry for all this trouble you went through.

    Can you try the following:

    1. Uninstall the code contracts msi

    2. Install the latest one.

    3. before starting VS, run devenv /setup from a VS command prompt.

    That should hopefully do the trick.

    The installation of the property pane is extremely tricky, and just setting these registry entries by hand will not work.

    -MaF


    Cheers, -MaF (Manuel Fahndrich)

    Thursday, March 1, 2012 10:13 PM
  • Followed your instructions.  No tab.  Any other ideas?


    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Thursday, March 1, 2012 10:30 PM
  • Try devenv /resetskippkgs to see if some package was disabled by mistake.


    Cheers, -MaF (Manuel Fahndrich)

    Sunday, March 4, 2012 8:21 PM
  • No go.

    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Monday, March 5, 2012 2:41 PM
  • I have had similar problems in the past on some systems. RIght now, I am running CodeContracts+ReSharper on 7 systems, and one of them also does not show the tab even though it recognizes and utilizes the CC settings. Another system appears to be having CC cache problems with the default settings. I think some VisualStudio settings may linger, even after you have "completely" removed it. Maybe because the VisualStudio "shell" is used by other programs (SQL studio maybe?). I use CC+RS on Windows7-32, Windows7-64, Server2008R2-64, and have also done the Ultimate/Premium/Pro shuffle on occassion (as well as 4.5/VS11Beta, VS2005, VS2008, SQL DENALI, ...). When desperate I have created a virtual machine and installed everything from scratch there to continue using CC+RS, but I don't know if that is an option for you.

    But I don't recall ever being able to clean this problem up enough where all the tabs appeared (and appeared to be working). I think there is some sort of /activityLog setting for VS but I have not tried it yet (a popup occurs suggesting this sometimes, but I have not tried it yet).

    I hope you folks can come up with a fix!

    Wednesday, March 7, 2012 6:51 AM
  • Hi Jeff, the reason the other tabs are gone is that once you add the "configpropertypages" key, you need to be explicit about all tabs that should be there.  Here is how it should look:

    Can you try if that works for you?

    Best,   Daan

    Wednesday, March 7, 2012 8:27 PM
  • Hi all, 

    I think I may have an idea why the install fails for some of you. In order to debug this, I would like to ask that some of you have have install problems send me a screenshot of their registry. In particular, I would like to see both the values of the C# project key, and the subkeys under the ConfigPropertyPages key. It should look like this (this is from my system):

    Wednesday, March 7, 2012 8:31 PM
  • Daan,

    I have none of those keys.  And not sure what vlaues would go with them.

    Jeff


    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    Wednesday, March 7, 2012 9:16 PM
  • Hi All!

    I had the same problem. I solve this by just adding section ConfigPropertyChange here:

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\ConfigPropertyPages]

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects\{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\ConfigPropertyPages\{1f89ca21-e885-439d-92f5-c36abe518593}]
    @="Microsoft Code Contracts Property Page"


    Thursday, March 8, 2012 3:12 PM
  • Daan,

    I have none of those keys.  And not sure what vlaues would go with them.

    Jeff

    Thanks for your reply. I actually need to see the values given on the project key itself ({FAE...}). Can you send me a screenshot of that -- just like I showed in my original post?

    (Also, because you have no subkeys in "ConfigPropertyPages" that explains why you don't see the property page for code contracts. I suspect it is because our tool for setting up these entries is failing and I need to see the values in the project key to figure out what is going wrong.)

    Thursday, March 8, 2012 6:24 PM
  • Hi Maximvm,

    What you did will work -- but you probably will also lose some of the default property pages. See my initial mail in this thread to see what other keys to add to get those back. 

    btw. Of course, our installer should take care of all of this registry magic so messing with these entries by hand is not recommended.

    Thursday, March 8, 2012 6:26 PM
  • Hi all,

    In order for us to debug this problem, we need a bit more information. I have set up a special version of the tool we use to set the registry entries at install time (CodeToolsUpdate.exe). It can be downloaded from here:

    https://skydrive.live.com/redir.aspx?cid=78ca02196aa02bfc&resid=78CA02196AA02BFC!152&parid=78CA02196AA02BFC!151&authkey=!AFgz9ThsiqcPcMY

    Just unpack the zip file and get the two files (CodeToolsUpdate.exe, diag.cmd), and close any visual studio instances you have open.

    Now, open a command prompt in *administrator* mode and run "diag.cmd".

    It should do an uninstall/install cycle and show lots of debug info. It may actually be that everything will start working after doing this, so please test this in VS. If it does not work yet, please post the output of the tool here or send it to me directly so we can see what goes wrong (hopefully :-) ). Also, if things magically start working after running this tool, let us know too so we can update the installer.

    Friday, March 9, 2012 5:45 PM
  • Hi.

    No, it does not help.

    Here is result:


    C:\Temp\CodeToolsDiag>.\codetoolsupdate /uninstall /verbose 
    CodeToolsUpdate Version 1.0.0.20703.
    Update for visual studio 10.0.
    Codetools: Property pane found: HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\10.0\CodeTools\$Installed\CodeContracts\PropertyPages\{6962fc39-92c8-4e9b-9e3e-4a52d08d1d83}
    Uninstalling Microsoft Code Contracts.
    Uninstalled Microsoft Code Contracts MSBuild targets.
    Codetools: Found associated project by name: Microsoft Code Contracts: VisualBasic: {F184B08F-C81C-45F6-A57F-5ABD9991F28F}
    Codetools: Uninstalled Microsoft Code Contracts property page for {F184B08F-C81C-45F6-A57F-5ABD9991F28F} projects
    Uninstalled Microsoft Code Contracts property pages.
    Update for visual studio 11.0.
    Codetools: Property pane found: HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\11.0\CodeTools\$Installed\CodeContracts\PropertyPages\{6962fc39-92c8-4e9b-9e3e-4a52d08d1d83}
    Uninstalling Microsoft Code Contracts.
    Uninstalled Microsoft Code Contracts MSBuild targets.
    Uninstalled Microsoft Code Contracts property pages.
    Update for visual studio 9.0.
    Codetools: Property pane found: HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\9.0\CodeTools\$Installed\CodeContracts\PropertyPages\{6962fc39-92c8-4e9b-9e3e-4a52d08d1d83}
    Uninstalling Microsoft Code Contracts.
    Uninstalled Microsoft Code Contracts MSBuild targets.
    Uninstalled Microsoft Code Contracts property pages.
    Done.


    C:\Temp\CodeToolsDiag>.\codetoolsupdate /install /verbose 
    CodeToolsUpdate Version 1.0.0.20703.
    Update for visual studio 10.0.
    Codetools: Property pane found: HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\10.0\CodeTools\CodeContracts\PropertyPages\{6962FC39-92C8-4e9b-9E3E-4A52D08D1D83}
    Installing Microsoft Code Contracts.
    Codetools: Install property pane for Microsoft Code Contracts
    Codetools: Found associated project by name: Microsoft Code Contracts: VisualBasic: {F184B08F-C81C-45F6-A57F-5ABD9991F28F}
    Codetools: project {F184B08F-C81C-45F6-A57F-5ABD9991F28F}: install default page: {6185191F-1008-4FB2-A715-3A4E4F27E610}
    Codetools: project {F184B08F-C81C-45F6-A57F-5ABD9991F28F}: install default page: {EDA661EA-DC61-4750-B3A5-F6E9C74060F5}
    Codetools: Installed Microsoft Code Contracts property page for {F184B08F-C81C-45F6-A57F-5ABD9991F28F} projects
    Codetools: Register installed property pane for Microsoft Code Contracts
    Installed Microsoft Code Contracts property pages.
    Installed Microsoft Code Contracts MSBuild targets.
    Update for visual studio 11.0.
    Codetools: Property pane found: HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\11.0\CodeTools\CodeContracts\PropertyPages\{6962FC39-92C8-4e9b-9E3E-4A52D08D1D83}
    Installing Microsoft Code Contracts.
    Codetools: Install property pane for Microsoft Code Contracts
    Codetools: Register installed property pane for Microsoft Code Contracts
    Installed Microsoft Code Contracts property pages.
    Installed Microsoft Code Contracts MSBuild targets.
    Update for visual studio 9.0.
    Codetools: Property pane found: HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\9.0\CodeTools\CodeContracts\PropertyPages\{6962FC39-92C8-4e9b-9E3E-4A52D08D1D83}
    Installing Microsoft Code Contracts.
    Codetools: Install property pane for Microsoft Code Contracts
    Codetools: Register installed property pane for Microsoft Code Contracts
    Installed Microsoft Code Contracts property pages.
    Installed Microsoft Code Contracts MSBuild targets.
    Done.

    Sunday, March 11, 2012 9:47 AM
  • btw. just info.

    As someone say in this thread - problem only with C# Projects.

    In VB projects all fine.

    Sunday, March 11, 2012 9:50 AM
  • Ha, thanks Maximvm. I think I now know what goes wrong. I am currently uploading a new version of CodeToolsUpdate and if you can run that one more time I think that will fix the issue. I'll post again once it is uploaded.
    Monday, March 12, 2012 10:27 PM
  • Hi DaanL!

    I download new zip file with CodeToolsUpdate.exe from your SkyDrive folder and try it.

    Situation looks like this:

    1. I uninstall Contracts.devlab9ts.msi from my machine.

    2. Run CodeToolsUpdate.exe /uninstall (in admin mode)

    3. Install Contracts.devlab9ts.msi

    4. Run CodeToolsUpdate.exe /install (in admin mode)

    5. Start VS and load some previously created solution with C# project, and... Code Contarcts tab is missing!!!

    6. I create new C# project, and.. all fine - i see Code Contarcts tab.

    7. After this i reload my solution from step 5 and all fine - i see all tabs include Code Contracts. :)

    it seems for VS 2010 propblem is solved! Its just needed to include correct version of registration tools to the Contracts.devlab9ts.msi package.

    Thanks a lot for your answers and help!!

    • Proposed as answer by baSSiLL Tuesday, March 27, 2012 11:53 AM
    Tuesday, March 13, 2012 10:16 AM
  • Daanl, Followed the above steps listed by maximvm and my CC tab is now correctly displayed. Thanks for your time and effort. Jeff

    Jeff Walker Software Architect Development Department Lender Processing Services, Inc. 50 South Water Ave., Sharon, PA 16146 Office: 800.441.0830 jeff.walker@lpsvcs.com www.LPSVCS.com

    • Proposed as answer by DaanL Wednesday, March 14, 2012 11:38 PM
    Tuesday, March 13, 2012 1:01 PM
  • also followed above steps - appears to have fixed my codecontracts tabs.

    thanks

    Wednesday, March 14, 2012 3:25 AM
  • Steps followed and tabs are OK!

    Thank you all!!

    Wednesday, March 14, 2012 7:55 PM
  • Yahoo -- glad to see this fixed the problem -- we will integrate these fixes as soon as possible into the installer.

    Thanks everyone for helping out to debug this problem!! :-)

    Wednesday, March 14, 2012 10:08 PM
  • Thanks. Just got Code Contracts page in VS2010 Ultimate.

    Unfortunately, trying to resolve problem, I already managed to uninstall Windows Phone SDK 7.1 (including VS 2010 Express for WP) and Visual C# 2008 Express used in other projects. Now need to reinstall :(

    Tuesday, March 27, 2012 11:57 AM
  • Hi,

    I faced with exactly the same issue on my machine having VS 2008? 2010 and 2013 installed at the same time. Until I added some extensions(don't remember exactly which) all 3 studios worked flawlessly.  Now all of them show me the same error message regarding "The imported project "C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v4.0\Microsoft.CodeContracts.targets" was not found". Tried to dounload our  CodeToolsUpdate.exe but didn't find it at all. What can I do to fix the issue?

    Friday, September 4, 2015 9:49 AM