SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

MSB4062 when running fxcop on pre-C#4.0 projects in RC4.2

Last post 07-15-2013 7:52 PM by sbridewell. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 05-01-2012 8:22 PM

    MSB4062 when running fxcop on pre-C#4.0 projects in RC4.2

    I've just installed this version of SharpDevelop

    SharpDevelop Version : 4.2.0.8774-RC-78ca36ef
    .NET Version         : 4.0.30319.261
    OS Version           : Microsoft Windows NT 6.1.7601 Service Pack 1
    Current culture      : English (United Kingdom) (en-GB)
    Running under WOW6432, processor architecture: x86-64
    Working Set Memory   : 245548kb
    GC Heap Memory       : 120372kb

    On attempting to build a C#2.0 / .net 2.0 project, I  get the following error:

    Error MSB4062: The "ICSharpCode.Build.Tasks.FxCop" task could not be loaded from the assembly C:\Program Files (x86)\SharpDevelop\4.2\bin\ICSharpCode.Build.Tasks.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\SharpDevelop\4.2\bin\ICSharpCode.Build.Tasks.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available.

    If I use the project upgrade to set the compiler version to C#4.0 then this error goes away but instead I get

    Error MSB3454: Tracker.exe is required to correctly incrementally generate resources in some circumstances, such as when building on a 64-bit OS using 32-bit MSBuild. This build requires Tracker.exe, but it could not be found.  The task is looking for Tracker.exe beneath the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A.  To solve the problem, either: 1) Install the Microsoft Windows SDK v7.0A or later. 2) Install Microsoft Visual Studio 2010. 3) Manually set the above registry key to the correct location. Alternatively, you can turn off incremental resource generation by setting the "TrackFileAccess" property to "false".

    If I also set the .net framework version to 4.0 then this error also goes away, but then I'm forcing any users of my application to install .net 4.0.

    This project builds quite happily as C# 2.0 and .net 2.0 in this version of SharpDevelop:

    SharpDevelop Version : 4.1.0.8000-736b5b66
    .NET Version         : 4.0.30319.261
    OS Version           : Microsoft Windows NT 6.1.7601 Service Pack 1
    Current culture      : English (United Kingdom) (en-GB)
    Running under WOW6432, processor architecture: x86-64
    Working Set Memory   : 93392kb
    GC Heap Memory       : 6990kb

    ... so I guess this is a bug which has crept into 4.2?

    Simon.

    Filed under:
  • 05-13-2012 1:54 PM In reply to

    • siegi44
    • Top 10 Contributor
    • Joined on 03-31-2006
    • Steyr, Austria
    • Posts 787
    • Team Members

    Re: MSB4062 when running fxcop on pre-C#4.0 projects in RC4.2

    Hi,

    the problem you are experincing is due to some changes in our build system to get rid of the .NET 3.5 dependency in SharpDevelop 4.

    To fix these problems please install the Windows SDK. You can use the C# 4 compiler independently of the framework version.

    regards,

    Siegfried

  • 05-14-2012 9:59 PM In reply to

    Re: MSB4062 when running fxcop on pre-C#4.0 projects in RC4.2

    Thanks for the reply, but it hasn't worked I'm afraid. Building using C# 2.0 still gives me the same error about the runtime not matching the one which was used to build the task, and building using C# 4.0 still gives me the same error about not being able to find tracker.exe.

    Tracker.exe is indeed present now, in both C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools and C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\x64.

    However, I notice the build error says it's looking for this .exe beneath the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A. I don't have this key, instead I've got a HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1 key with an InstallationFolder of C:\Program Files\Microsoft SDKs\Windows\v7.1\.

    I've tried creating a v7.0A key manually and adding this InstallationFolder value to it, but MSBuild is still complaining that it can't find tracker.exe

    Any ideas greatfully received...

    Simon

  • 05-14-2012 11:35 PM In reply to

    Re: MSB4062 when running fxcop on pre-C#4.0 projects in RC4.2

    Try setting the CurrentVersion registry value to 7.1 in HKLM\Software\Microsoft\Microsoft SDKs\Windows. There is also a CurrentInstallFolder but I believe just the CurrentVersion registry value is used to determine which subkey to use.

  • 05-15-2012 8:18 PM In reply to

    Re: MSB4062 when running fxcop on pre-C#4.0 projects in RC4.2

    No joy I'm afraid. I tried setting both the CurrentVersion and CurrentInstall values, and rebooted too for good measure, but I'm still getting the same error about not being able to find tracker.exe.

    Simon

  • 01-27-2013 5:53 PM In reply to

    Re: MSB4062 when running fxcop on pre-C#4.0 projects in RC4.2

    Are there any news on this issue?


    It is currently keeping me from compiling projects where FxCop should run with SharpDevelop 4.3 :-/

  • 01-27-2013 7:34 PM In reply to

    Re: MSB4062 when running fxcop on pre-C#4.0 projects in RC4.2

    There are two problems identified.

    1) Using FxCop with a project that targets .NET 3.5 or older when using the C# 2.0 or C# 3.0 compiler.

    I doubt we will support this. It would require maintaining two versions of the build task to support both .NET 2.0 and .NET 4.0. The workaround is to use SharpDevelop 3 or upgrade the project to use the C# 5.0 compiler. Using the C# 5.0 compiler allows you to run FxCop against an assembly that targets .NET 2.0. Another workaround might be to use the ICSharpCode.Build.Tasks.dll from SharpDevelop 3 and replace the existing file in SharpDevelop 4.3.

    2) Tracker.exe is not found.

    This is a problem with the software installed on the developer machine and not something that we can fix as far as I am aware.

  • 07-15-2013 7:52 PM In reply to

    Re: MSB4062 when running fxcop on pre-C#4.0 projects in RC4.2

    I think I've found the answer to the tracker.exe problem whilst playing with invoking MSBuild via MSBuild Explorer rather than via an IDE like SharpDevelop. And it's not a bug in SharpDevelop by the looks of things, it's a missing step after installing the Windows SDK on a machine which doesn't have Visual Studio 2010 installed. I resolved it like this:

    • Find the Windows SDK v7.1 folder in the start menu
    • Open the Windows SDK 7.1 command prompt
    • cd Setup
    • WindowsSdkVer -version:v7.1

    This tells MSBuild to use that version of the Windows SDK (which is probably what the error message's suggestion of editing a registry entry was trying to achieve).

    Thanks to http://ermakovich.blogspot.co.uk/2011/11/msbuild-error-related-to-missing.html where I found this.

Page 1 of 1 (8 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.