I added a build step for code inspection with Reshaper but obtained: Solution has unresolved references

The previous build steps compiles the code successfully. However, resharper code inspection gives:

Step 4/6: Copy of Inspection (Inspections (.NET)) (1m:34s)

Solution has unresolved references: assembly 'Microsoft.VisualStudio.Shell.Immutable.10.0.dll' in project 'MyProject'
Solution has unresolved references: assembly 'Microsoft.VisualStudio.Shell.Interop.10.0.dll' in project 'MyProject'
Solution has unresolved references: assembly 'Northwoods.GoWPF' in project MyProject2'

I am using TeamCity Enterprise 7.0.3 (build 21424)
Microsoft.VisualStudio.Shell.Immutable.10.0.dll is included in Visual Studio 2010 SDK and Northwoods.GoWpf.dll is copied in Build Output directory. (The code compiled OK!)

What is causing this error?

Thank you
3 comments
Comment actions Permalink

If that helps, I try several other things without resolving my issue.
What I have discover is that there are MSBUILD variable used in the hint path for reference dlls.

1:27:58 PM.076: Thread:1: EXCEPTION: Unable to load assembly via MetadataLoader.TryLoadFrom from MyCompany.Setup.dll
Unable to load assembly via MetadataLoader.TryLoadFrom from MyCompany.Setup.dll ---> System.Exception: Unable to load assembly via MetadataLoader.TryLoadFrom from MyCompany.Setup.dll ---> System.Exception: Can't create metadata reader from MyCompany.Setup.dll ---> System.IO.FileNotFoundException: Metadata file is not found
File name: 'C:\TeamCityBuildAgent\work\a8ae55f6eabee5c4\MyCompany\AAM\MyCompany.Setup\$(SolutionDir)Bin\Debug\MyCompany.Setup.dll'
   at JetBrains.Metadata.Access.ILReader.ILReaderMetadataProvider.GetFromFile(FileSystemPath fsp)
   --- End of inner exception stack trace ---
   at JetBrains.Metadata.Access.ILReader.ILReaderMetadataProvider.GetFromFile(FileSystemPath fsp)
   at JetBrains.Metadata.Reader.API.MetadataLoader.LoadAssemblyModule(FileSystemPath file, IMetadataAccess access, MetadataToken moduleToken, Func`2 predicate)
   at JetBrains.Metadata.Reader.API.MetadataLoader.TryLoadFrom(FileSystemPath file, Func`2 predicate)
   --- End of inner exception stack trace ---
   Exception_EndOfInnerExceptionStack
   at JetBrains.ProjectModel.Model2.Assemblies.Impl.Assembly.Refresh()
   at JetBrains.ProjectModel.Model2.Assemblies.Impl.AssemblyCollection.AddAssembly(Assembly assembly)
   at JetBrains.ProjectModel.src.model2.Assemblies.Impl.AssemblyFactory.GetOrCreateAssemblyFileInternal(FileSystemPath expectedLocation, PlatformID platformId)
   at JetBrains.ProjectModel.src.model2.Assemblies.Impl.AssemblyFactory.AddRef(AssemblyReferenceResolveResult resolveResult, String holderId, PlatformID platformID)
   at JetBrains.ProjectModel.Build.BuildSettingsManager.SetOutputAssemblyFile()
   at JetBrains.ProjectModel.Build.BuildSettingsManager.AfterComponentsCreated()
   at JetBrains.DataFlow.Lifetime.AddBracket(Action FOpening, Action FClosing)
   at JetBrains.ProjectModel.Impl.ProjectInstance.InitializeComponents()
   at JetBrains.ProjectModel.Impl.ProjectManagerBase.OpenProject(IProject project)
   at JetBrains.ProjectModel.Impl.ProjectManagerInitializer.<>c__DisplayClass4.<.ctor>b__0()
   at JetBrains.DataFlow.Lifetime.AddBracket(Action FOpening, Action FClosing)
   at JetBrains.ProjectModel.Impl.ProjectManagerInitializer..ctor(Lifetime lifetime, ISolution solution, ProjectManager projectManager, IShellLocks locks, ProjectModelElementPointerManager doNotRemove)
   at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at JetBrains.Application.Components.TypeComponentDescriptor.CreateInstanceImpl()
   at JetBrains.Application.Components.TypeComponentDescriptor.CreateInstance()
   at JetBrains.Application.Components.TypeComponentDescriptor.CreateInstanceChecked(OnError onError)
   at JetBrains.Application.Components.TypeComponentDescriptor.get_Instance()
   at JetBrains.Application.Components.ComponentContainer.ResolveDescriptors(IEnumerable`1 descriptors)
   at JetBrains.Application.Components.ComponentContainer.Compose()
   at JetBrains.ProjectModel.Impl.SolutionInstanceBase.Open()
   at JetBrains.ProjectModel.Impl.SolutionManagerImpl.OpenExistingSolution(FileSystemPath solutionFilePath, ITaskExecutor executor)
   at JetBrains.CommandLine.InspectCode.InspectCode.<>c__DisplayClass6.<OpenSolution>b__5()
   at JetBrains.Application.IShellLocksEx.ExecuteWithWriteLock(IShellLocks th?s, Action F)
   at JetBrains.CommandLine.InspectCode.InspectCode.<>c__DisplayClass26.<ExecuteWithWriteLock>b__25()
   at Action(IncpectCode.OpenSolution).Execute(Action )
   at JetBrains.Threading.ReentrancyGuard.Execute(String name, Action action)
   at JetBrains.CommandLine.InspectCode.InspectCode.ExecuteWithWriteLock(String name, Action action)
   at JetBrains.CommandLine.InspectCode.InspectCode.OpenSolution(FileSystemPath solutionFilePath)
   at JetBrains.CommandLine.InspectCode.InspectCode.Run()
   at JetBrains.CommandLine.InspectCode.InspectCodeProgram.DoMain(ICommandLine cmdline)
   at JetBrains.CommandLine.InspectCode.InspectCodeProgram.Main(String[] args)
Any idea?

0
Comment actions Permalink

I found the error.
In the .csproj, the reference assembly has the ".dll" at the end. Removing it, solve the bug. Visual Studio does not care about this:
    <Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0.dll" />
However, Code Inspection on team city requires this:
    <Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0" />

And for the other unresolved dll, Code Inspection on team city  does not support the following :
      <HintPath>$(SolutionDir)Bin\Components\Aam\X.Setup.dll</HintPath>

I had to change all hintpaths to
      <HintPath>..\Bin\Components\Aam\X.Setup.dll</HintPath>

0
Comment actions Permalink

I still obtain the following error during .Net code inspection:
[Step 3/3] Solution has unresolved references:
assembly 'Microsoft.Pex.Framework' in project X

0

Please sign in to leave a comment.