none
upgrade to vs 2010 + net 4 => The type 'System.Func<TResult>' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll' and 'c:\WINDOWS\microsoft.net\Framework64\v4.0.30319\mscorlib.dll'

    Question

  • Hi.

     

    I've tried upgrading my sharepoint workflow solution from vs 2008 to vs 2010 but I ran into the following compile error:

    The type 'System.Func<TResult>' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll' and 'c:\WINDOWS\microsoft.net\Framework64\v4.0.30319\mscorlib.dll'

    Any ideas why ?

     

    I'm using a 64 bit machine.

     

    Thanks

     

    Friday, April 16, 2010 5:35 AM

All replies

  • Most likely you couldn't mix System.Core from 3.5 with .NET Framework 4.0. You should reference System.Core 4.0 instead.
    Friday, April 16, 2010 7:10 AM
  • Hi Clement,

     

    In .NET Framework 4.0, the definition ofSystem.Func<TResult> class is moved fromSystem.Core.dll to mscorlib.dll , it sounds that your project references both System.Core.dllv3.5 and mscorlib.dll v4.0 , and both the two dlls defineSystem.Func<TResult> class, that's why you get above build error.

     

    Please change the .NET Framework target to see whether it helps:you can change the .NET Framework target by clicking Properties on the Project menu and then selecting a new target in the '.NET Framework' dropdown box.

     

    Anyway, System.Cord.dlland mscorlib.dll are automatically referenced by the build system, so the two dlls should have same version, what VS 2010 version are you using? Could you provide some reproduce steps?


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, April 16, 2010 8:31 AM
  • Hi.

    I understand but all my projects still target Net 3.5 so why is a reference being automatically added to mscorlib.dll v4 and how do I remove it ?

    Monday, April 19, 2010 12:11 AM
  • One thing I noticed is that the following has been changed in my .csproj files:

    Before conversion to VS 2010:

    <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

     

    After conversion to VS 2010:

    <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

     

    Similarly my Settings.Designer.cs have been changed:

    before:

    //------------------------------------------------------------------------------
    // <auto-generated>
    //     This code was generated by a tool.
    //     Runtime Version:2.0.50727.3053
    //
    //     Changes to this file may cause incorrect behavior and will be lost if
    //     the code is regenerated.
    // </auto-generated>
    //------------------------------------------------------------------------------

    namespace Syple.Pips.AdditionalSuperWorkflow.Properties {
       
       
        [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
        internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
           
            private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
           
            public static Settings Default {
                get {
                    return defaultInstance;
                }
            }
        }
    }

     

    after:

    //------------------------------------------------------------------------------
    // <auto-generated>
    //     This code was generated by a tool.
    //     Runtime Version:4.0.30319.1
    //
    //     Changes to this file may cause incorrect behavior and will be lost if
    //     the code is regenerated.
    // </auto-generated>
    //------------------------------------------------------------------------------

    namespace Syple.Pips.AdditionalSuperWorkflow.Properties {
       
       
        [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
        internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
           
            private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
           
            public static Settings Default {
                get {
                    return defaultInstance;
                }
            }
        }
    }

    Monday, April 19, 2010 12:17 AM
  • The .csproj file looks fine.

    Anyway, I still cannot reproduce this issue in my side, is there any special setting in your project? Could you provide some reproduce steps?


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com .
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, April 19, 2010 9:17 AM
  • I tried creating a Sharepoint Workflow project to see if I could reproduce the error in a project from scratch but I get a error dialog message saying:

     

    "A 32 bit version of Windows SharePoint Services is required by this project but is not installed on the system. Please install ........ "

    It seems to be a 32/64 bit issue, the original message seems to be using both 32 and 64 bit dlls:

    The type 'System.Func<TResult>' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll' and 'c:\WINDOWS\microsoft.net\Framework64\v4.0.30319\mscorlib.dll'

    However I'm still not sure on how to fix it.

    Tuesday, April 20, 2010 5:01 AM
  • This article show a solution for the error message " A 32-bit version of SharePoint Server is not installed. Please install a 32-bit version of SharePoint Server " , you may have a try.

     

    This is a know issue and Microsoft are apparently working on it, but in the mean time here is a nice way around it. If you have the WSPBuilder extension for Visual Studio installed ( www.codeplex.com/wspbuilder ) just use the project template it provides for a WSP Builder project and you can then add workflows to your project.

     

    You mentioned that the application is firstly developed on VS 2008, and then upgrade to VS 2010. Did you use the same machine?  


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, April 21, 2010 2:01 AM
  • I am running into same issue when upgrading to VS2010 and keeping target framework as 3.5. I am using VS2010 version 10.0.30319.1.

    Error:

    The type 'System.Func<T,TResult>' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll'  

     

    What's the fix for this issue?

     

    Thanks

     


    R
    Wednesday, April 21, 2010 3:57 PM
  • eryang yes i do use the same machine.
    Thursday, April 22, 2010 2:08 AM
  • With the solution provided by that article , can you create a new SharePoint Workflow project now? can you reproduce this issue? if so, could you please post some reproduce steps here, thanks.

     

    @mehrit, is this issue reproducible in your machine? it will be very helpful to find out the root cause if you could provide some reproduce steps.


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com .
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, April 22, 2010 6:14 AM
  • I can't install wspbuilder on this shared dev machine but I could create WF with vs 2008, just not with vs 2010
    Thursday, April 22, 2010 6:37 AM
  • @eryang - yes it is reproducible. I undid all the changes for the migration and started over. I am using the Visual Studio migration wizard to convert entire solution. On compile it throws this exception.

    Looking at the .csproj for the project reference for System.Core changed from

        <Reference Include="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
          <RequiredTargetFramework>3.5</RequiredTargetFramework>
        </Reference>

    to

        <Reference Include="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />

    Another point is one of the project (test project) is converted to 4.0 whereas all other projects have target framework as 3.5. Trying to change the framework back to 3.5 is not being allowed.

    Let me know what additional information I can provide for debugging.

    @Clement - Apologies to use same thread. I thought since the issue is same, it will benefit the resolution faster. If needed, will start another one.

    Thanks

     


    R
    Thursday, April 22, 2010 3:16 PM
  • no pb mehrit, it's probably the same problem.
    Friday, April 23, 2010 12:01 AM
  • @mehrit, could you please provide the full content of .csproj file (before and after converted to VS2010 project)?

    Meanwhile, you may consider posting this issue to https://connect.microsoft.com


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, April 26, 2010 5:20 AM
  • One of my colleague found the issue. Had to manually change the tool version in csproj file to 4.0

    Original

    <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003 " ToolsVersion=" 2.0 ">

     

    Change to

    <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003 " ToolsVersion=" 4.0 ">

     

    Now need to figure out other errors :-)

     

    Thanks


    R
    • Proposed as answer by mehrit Monday, April 26, 2010 4:27 PM
    Monday, April 26, 2010 4:26 PM
  • Hi Clement,

    Did you try mehrit's workaround solution, is it help?


    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, April 28, 2010 12:14 AM
  • No, the conversion wizard had already changed to ToolsVersion=" 4.0 automatically anyway
    Thursday, April 29, 2010 4:38 AM
  • You may consider posting this issue to https://connect.microsoft.com
    Sincerely,
    Eric
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, May 3, 2010 5:52 AM
  • I'm having the exact same issue. I started a Connect here: https://connect.microsoft.com/VisualStudio/feedback/details/558245/warning-cs1685-when-compiling-a-v3-5-net-application-in-visual-studio-2010

    Is there a Connect Feedback Submission that resulted from this thread that I could take a look at. This problem is blocking me. 

    Tuesday, May 11, 2010 6:53 PM
  • I get this error with SharePoint after upgrading workflow projects from 32-bit VS2008 to 64-bit VS2010 . It occurs when I right-click on the Project and choose "SharePoint Debug Settings...".

    ---------------------------
    Microsoft Visual Studio
    ---------------------------
    A 32-bit version of Windows SharePoint Services is required by this project but is not installed on the system. Please install Windows SharePoint Services 3.0, available either from the Microsoft Download Center or as part of Microsoft Office SharePoint Server 2007.
    ---------------------------
    OK   Help  
    ---------------------------

    Eryang's post above ( Wednesday, April 21, 2010 2:01 AM) suggests looking at a Windows Live Spaces article which unfortunately is missing.

    How do I upgrade this Project to a proper Visual Studio SharePoint 2010 project without having to rebuild it? (My first rebuild attempt has already failed).

    Wednesday, August 18, 2010 7:14 AM