locked
VS2010/.NET framework 4: Compile errors & warnings MSB3265/MSB3253 - Referenced assembly could not be resolved RRS feed

  • Question

  • I get compilation errors in projects with a reference to another one (lets call the project that they refer to 'ClassLib1'). The errors are:
    CS0246: The type or namespace name 'xxxx' could not be found (are you missing a using directive or an assembly reference?)

    Of course this means that they somehow cannot find or use ClassLib1. The question is: why?

    The projects were created in VS2008 targetting .NET framework 3.5. I converted the projects with the VS2010 wizard and retargetted them to framework 4.0.
    Deleting the reference to the missing assembly and recreating it using 'Add reference...' and then selecting the required project does not solve the problem.
    If I compile just the project 'ClassLib1' itself, no errors or warning are displayed.
    But if I compile another project referring to ClassLib1, I get the following warnings:

    C:\Windows\Microsoft.NET\Framework\v4.0.20506\Microsoft.Common.targets(1337,9): warning MSB3265: The primary reference "D:\Projects\aaa\ClassLib1\bin\Debug\ClassLib1.dll" could not be resolved because it has an indirect dependency on the .NET Framework assembly "Microsoft.ShDocVw, Version=8.0.50705.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which has a public key token of "B03F5F7F11D50A3A" and has been located in the GAC or AssemblyFolders search locations. The assembly has been added to an exclusion list. Assemblies with this public key token should not be resolved from the GAC or the Assemblyfolders search locations. If this reference is required change the reference include to a fusion name and set <SpecificVersion> metadata to true.
    C:\Windows\Microsoft.NET\Framework\v4.0.20506\Microsoft.Common.targets(1337,9): warning MSB3253: The referenced assembly "D:\Projects\aaa\ClassLib1\bin\Debug\ClassLib1.dll" could not be resolved because it has a dependency on "Microsoft.ShDocVw, Version=8.0.50705.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is in a generated exclusion list which excludes it from the targeted framework ".NETFramework,Version=v4.0". If this reference is required by your code, you may get compilation errors. If this reference is required change the reference include to a fusion name and set <SpecificVersion> metadata to true.

    The ClassLib1 project itself does not use anything in Microsoft.ShDocvW and does not refer to 'Microsoft.ShDocVw'
    It contains the following references:
    (Version 4.0.0.0, Runtime version v4.0.20506):
    System
    System.configuration
    System.Core
    System.Data
    System.Data.DataSetExtensions
    System.Data.Linq
    System.Runtime.Remoting
    System.Runtime.Serialization
    System.ServiceModel
    System.Transactions
    System.Web
    System.Xml
    System.Xml.Linq
    and
    Microsoft.VisualStudio.QualityTools.LoadTestFramework (v10.0.0.0, runtime version v2.0.50727) (-why not v4.0.20506?)
    Microsoft.VisualStudio.QualityTools.UnitTestFramework (v10.0.0.0, runtime version v4.0.20506)
    Microsoft.VisualStudio.QualityTools.WebTestFramework (v10.0.0.0, runtime version v2.0.50727)
    ICSharpCode.SharpZipLib (runtime v2.0.50727) - only refers to System and mscorlib 

    How can I solve this problem?

    Thursday, May 21, 2009 11:30 AM

Answers

All replies

  • I got the same error when reference to "Microsoft.Practices.EnterpriseLibrary.Common". 

    The primary reference "Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which has a public key token of "B03F5F7F11D50A3A" and has been located in the GAC or AssemblyFolders search locations. The assembly has been added to an exclusion list. Assemblies with this public key token should not be resolved from the GAC or the Assemblyfolders search locations. If this reference is required change the reference include to a fusion name and set <SpecificVersion> metadata to true.

    It only happen if my project targets to .net framework 4.0. There are any workaround?
    Tuesday, June 2, 2009 4:06 AM
  • You will probably need to rebuild the Enterprise Library from source under .NET 4.0 and then change your reference to the updated version.

    Thanks,
    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Thursday, June 4, 2009 5:14 PM
  • Wednesday, June 24, 2009 6:53 PM
    Moderator
  • I tried to recompile the EntLib source under .NET 4.0 using a modified BuildLibrary.bat (had to point some env vars in the batch file to the .NET 4.0 / VS2010 dirs first.)

    Still, I get this error during the build:

    Configuration\ConfigurationFileSourceWatcher.cs(59,100): error CS1734: Warning
    as Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Common.Configur
    ation.ConfigurationFileSourceWatcher.GetFullFileName(string, string)' has a par
    amref tag for 'configurationFilePath', but there is no parameter by that name [
    C:\EntLib41Src\Blocks\Common\Src\Common.csproj]
    Configuration\DictionaryConfigurationSource.cs(61,64): error CS1734: Warning as
     Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Common.Configurat
    ion.DictionaryConfigurationSource.Add(string, System.Configuration.Configuratio
    nSection)' has a paramref tag for 'configurationSection', but there is no param
    eter by that name [C:\EntLib41Src\Blocks\Common\Src\Common.csproj]
    Configuration\Manageability\ConfigurationSectionManageabilityProvider.cs(252,42
    ): error CS1735: Warning as Error: XML comment on 'Microsoft.Practices.Enterpri
    seLibrary.Common.Configuration.Manageability.ConfigurationSectionManageabilityP
    rovider.OverrideWithGroupPoliciesAndGenerateWmiObjects(System.Configuration.Con
    figurationSection, bool, Microsoft.Practices.EnterpriseLibrary.Common.Configura
    tion.Manageability.IRegistryKey, Microsoft.Practices.EnterpriseLibrary.Common.C
    onfiguration.Manageability.IRegistryKey, bool, System.Collections.Generic.IColl
    ection<Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Manageability
    .ConfigurationSetting>)' has a typeparamref tag for 'T', but there is no type p
    arameter by that name [C:\EntLib41Src\Blocks\Common\Src\Common.csproj]
    Configuration\ObjectBuilder\AssemblerBasedObjectFactory.cs(49,81): error CS1735
    : Warning as Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Commo
    n.Configuration.ObjectBuilder.AssemblerBasedObjectFactory<TObject,TConfiguratio
    n>.Create(Microsoft.Practices.ObjectBuilder2.IBuilderContext, TConfiguration, M
    icrosoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource,
     Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.Confi
    gurationReflectionCache)' has a typeparamref tag for 'Tobject', but there is no
     type parameter by that name [C:\EntLib41Src\Blocks\Common\Src\Common.csproj]
    Configuration\ObjectBuilder\AssemblerBasedCustomFactory.cs(43,81): error CS1735
    : Warning as Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Commo
    n.Configuration.ObjectBuilder.AssemblerBasedCustomFactory<TObject,TConfiguratio
    n>.Create(Microsoft.Practices.ObjectBuilder2.IBuilderContext, string, Microsoft
    .Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource, Microso
    ft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.Configuration
    ReflectionCache)' has a typeparamref tag for 'Tobject', but there is no type pa
    rameter by that name [C:\EntLib41Src\Blocks\Common\Src\Common.csproj]
    Configuration\ObjectBuilder\AssemblerBasedCustomFactory.cs(78,81): error CS1735
    : Warning as Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Commo
    n.Configuration.ObjectBuilder.AssemblerBasedCustomFactory<TObject,TConfiguratio
    n>.CreateObject(Microsoft.Practices.ObjectBuilder2.IBuilderContext, string, Mic
    rosoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource, M
    icrosoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.Configu
    rationReflectionCache)' has a typeparamref tag for 'Tobject', but there is no t
    ype parameter by that name [C:\EntLib41Src\Blocks\Common\Src\Common.csproj]
    Configuration\SystemConfigurationSource.cs(146,23): error CS1734: Warning as Er
    ror: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration
    .SystemConfigurationSource.Add(Microsoft.Practices.EnterpriseLibrary.Common.Con
    figuration.IConfigurationParameter, string, System.Configuration.ConfigurationS
    ection)' has a paramref tag for 'saveParameter', but there is no parameter by t
    hat name [C:\EntLib41Src\Blocks\Common\Src\Common.csproj]
    Configuration\SystemConfigurationSource.cs(150,23): error CS1734: Warning as Er
    ror: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration
    .SystemConfigurationSource.Add(Microsoft.Practices.EnterpriseLibrary.Common.Con
    figuration.IConfigurationParameter, string, System.Configuration.ConfigurationS
    ection)' has a paramref tag for 'saveParameter', but there is no parameter by t
    hat name [C:\EntLib41Src\Blocks\Common\Src\Common.csproj]
    Configuration\Unity\EnterpriseLibraryBlockExtension.cs(143,87): error CS1734: W
    arning as Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Common.C
    onfiguration.Unity.EnterpriseLibraryBlockExtension.GetContainerPolicyCreator(Sy
    stem.Type, System.Type)' has a paramref tag for 'type', but there is no paramet
    er by that name [C:\EntLib41Src\Blocks\Common\Src\Common.csproj]
    Configuration\Unity\EnterpriseLibraryBlockExtension.cs(150,26): error CS1734: W
    arning as Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Common.C
    onfiguration.Unity.EnterpriseLibraryBlockExtension.GetContainerPolicyCreator(Sy
    stem.Type, System.Type)' has a paramref tag for 'type', but there is no paramet
    er by that name [C:\EntLib41Src\Blocks\Common\Src\Common.csproj]
    Instrumentation\IExplicitInstrumentationBinder.cs(23,38): error CS1734: Warning
     as Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Common.Instrum
    entation.IExplicitInstrumentationBinder.Bind(object, object)' has a paramref ta
    g for 'listenerMethod', but there is no parameter by that name [C:\EntLib41Src\
    Blocks\Common\Src\Common.csproj]
    Instrumentation\IExplicitInstrumentationBinder.cs(24,27): error CS1734: Warning
     as Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Common.Instrum
    entation.IExplicitInstrumentationBinder.Bind(object, object)' has a paramref ta
    g for 'sourceEvent', but there is no parameter by that name [C:\EntLib41Src\Blo
    cks\Common\Src\Common.csproj]
    Instrumentation\IExplicitInstrumentationBinder.cs(26,76): error CS1734: Warning
     as Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Common.Instrum
    entation.IExplicitInstrumentationBinder.Bind(object, object)' has a paramref ta
    g for 'listenerMethod', but there is no parameter by that name [C:\EntLib41Src\
    Blocks\Common\Src\Common.csproj]
    Instrumentation\IExplicitInstrumentationBinder.cs(27,86): error CS1734: Warning
     as Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Common.Instrum
    entation.IExplicitInstrumentationBinder.Bind(object, object)' has a paramref ta
    g for 'listenerMethod', but there is no parameter by that name [C:\EntLib41Src\
    Blocks\Common\Src\Common.csproj]

    The first error reports that there is no parameter called configurationFilepath in the method GetFullFileName, but it's clearly there.
    Monday, July 13, 2009 7:05 PM
  • To workaround, I disabled "Warnings as Errors" and also had to re-add references to System.Runtime.Serialization and System.ServiceModel in all of the WCF projects.  For some reason, these references were invalid after the conversion wizard.
    Tuesday, July 14, 2009 6:48 PM
  • Thanks for replying back here. That's interesting that those references were invalid. I would wonder if the reference property had the specific version set to true on those or if the conversion wizard might have set this property to true with the assumption that it was targeting .NET 3.5 when you wanted to target .NET 4.0.

    Thanks,
    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Tuesday, July 14, 2009 7:04 PM

  • As a work round ->right click the dll and select “True” for the property “Specific Version”.

    Its known bug shipped with VS2010 and hopefully get resolved in coming version.

    Tuesday, September 15, 2009 12:04 PM
  • the DLL doesn't have the property 'specific version'!
    specifically what causes the problem is the reference to qualitytools.webtestframework
    Wednesday, September 16, 2009 12:36 PM
  • the DLL doesn't have the property 'specific version'!
    specifically what causes the problem is the reference to qualitytools.webtestframework

    Error 1 Warning as Error: XML comment on 'Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.IExplicitInstrumentationBinder.Bind(object, object)' has a paramref tag for 'listenerMethod', but there is no parameter by that name E:\SCM_App\SCM_App\Microsoft.Practices\Common\Instrumentation\IExplicitInstrumentationBinder.cs 23 38 Common


    public

     

     

    interface IExplicitInstrumentationBinder

    {

     

     

    /// <summary>

     

     

    /// Adds specified <paramref name="listenerMethod"></paramref> as an event handler for

     

     

    /// the <paramref name="sourceEvent"></paramref>.

     

     

    /// </summary>

     

     

    /// <param name="source">Event on source object to which <paramref name="listenerMethod"></paramref> will be added.</param>

     

     

    /// <param name="listener">Method to be added as event handler for <paramref name="listenerMethod"></paramref>.</param>

     

     

    void Bind(object source, object listener);

    }

    Monday, December 14, 2009 10:59 AM
  • Specific Version set to true worked for me....

    Sunday, May 23, 2010 6:52 PM