Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll not found error at build - c#

I have issues while building a UnitTest project using C# from VS 2017
I have the following Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll assemblies on machine
C:>dir /s Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Volume in drive C has no label.
Volume Serial Number is 3DA9-D3C3
Directory of C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow
05/09/2018 11:35 AM 98,864 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
1 File(s) 98,864 bytes
Directory of C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\x64
05/09/2018 11:35 AM 98,864 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
1 File(s) 98,864 bytes
Directory of C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\TestPlatform
05/29/2018 04:22 PM 89,744 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
1 File(s) 89,744 bytes
Directory of C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies
05/09/2018 11:35 AM 98,856 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
1 File(s) 98,856 bytes
Directory of C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\ReferenceAssemblies\v2.0
05/09/2018 11:35 AM 86,848 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
1 File(s) 86,848 bytes
Directory of C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\ReferenceAssemblies\v4.0
05/09/2018 11:35 AM 98,856 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
1 File(s) 98,856 bytes
Directory of C:\Users\IBM_ADMIN.nuget\packages\microsoft.visualstudio.qualitytools.unittestframework.updated\15.0.26228\lib
06/18/2018 05:16 PM Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
0 File(s) 0 bytes
Directory of C:\Users\IBM_ADMIN.nuget\packages\microsoft.visualstudio.qualitytools.unittestframework.updated\15.0.26228\lib\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
06/13/2017 04:16 PM 98,440 Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
1 File(s) 98,440 bytes
Total Files Listed:
7 File(s) 670,472 bytes
1 Dir(s) 43,857,920,000 bytes free
Errors are:
Severity Code Description Project File Line Suppression State
Error Error occurred during processing of assembly 'D:\code\tsm\tdp\agents\mmc\Fm.Common\bin_816\Release\Fm.Common.dll': Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Fm.Common.UnitTests
Severity Code Description Project File Line Suppression State
Error The "BuildShadowTask" task failed unexpectedly.
Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.PublicizeException: Error occurred during processing of assembly 'D:\code\tsm\tdp\agents\mmc\Fm.Common\bin_816\Release\Fm.Common.dll': Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.DynamicTypeEmitter.EmitAttachShadow()
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.DynamicTypeEmitter..ctor(DynamicType type, ShadowerTargetType targetType)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.DynamicType..ctor(DynamicAssembly assembly, TypeBuilder outerType, Type type, TypeCreatorDelegate TypeCreator, ShadowerTargetType targetType)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.DynamicAssembly.ShadowType(Type type)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssemblyHelper(ShadowerOptions options)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssemblyHelper(ShadowerOptions options)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssemblyHelper(ShadowerOptions options)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssembly(AppDomain domain, ShadowerOptions options)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssembly(ShadowerOptions options)
at Microsoft.VisualStudio.TestTools.BuildShadowReferences.BuildShadowTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() Fm.Common.UnitTests
Severity Code Description Project File Line Suppression State
Error The "BuildShadowTask" task failed unexpectedly.
Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.PublicizeException: Error occurred during processing of assembly 'D:\code\tsm\tdp\agents\mmc\Fm.Common\bin_816\Release\Fm.Common.dll': Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.DynamicTypeEmitter.EmitAttachShadow()
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.DynamicTypeEmitter..ctor(DynamicType type, ShadowerTargetType targetType)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.DynamicType..ctor(DynamicAssembly assembly, TypeBuilder outerType, Type type, TypeCreatorDelegate TypeCreator, ShadowerTargetType targetType)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.DynamicAssembly.ShadowType(Type type)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssemblyHelper(ShadowerOptions options)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssemblyHelper(ShadowerOptions options)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssemblyHelper(ShadowerOptions options)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssembly(AppDomain domain, ShadowerOptions options)
at Microsoft.VisualStudio.TestTools.UnitTesting.Publicize.Shadower.ShadowAssembly(ShadowerOptions options)
at Microsoft.VisualStudio.TestTools.BuildShadowReferences.BuildShadowTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() Fm.Common.UnitTests

I had the same issue, problem was that there was a accessor file used. What is no more supportet by visual Stuio, so I removed it from the csproj file.
<ItemGroup>
<Shadow Include="Test References\Abc.xy.accessor" />
</ItemGroup>

Related

Visual Studio 2022 build throws FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=6.0.0.0

Using Microsoft Visual Studio 2022 to build a C# Web API project with .NET 6 Framework, the project builds fine on one machine. I cloned the same source code repository into a different machine, but when building in the new machine I get the following error:
FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
at Microsoft.AspNetCore.Razor.Tasks.StaticWebAssetsManifest.ComputeManifestHash()
at Microsoft.AspNetCore.Razor.Tasks.StaticWebAssetsManifest.Create(String source, String basePath, String mode, String manifestType, ReferencedProjectConfiguration[] referencedProjectConfigurations, DiscoveryPattern[] discoveryPatterns, StaticWebAsset[] assets)
at Microsoft.AspNetCore.Razor.Tasks.GenerateStaticWebAssetsManifest.Execute()
ResultsMonitor.API C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets 411
Severity Code Description Project File Line Suppression State
Error FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
at Microsoft.AspNetCore.Razor.Tasks.StaticWebAssetsManifest.ComputeManifestHash()
at Microsoft.AspNetCore.Razor.Tasks.StaticWebAssetsManifest.Create(String source, String basePath, String mode, String manifestType, ReferencedProjectConfiguration[] referencedProjectConfigurations, DiscoveryPattern[] discoveryPatterns, StaticWebAsset[] assets)
at Microsoft.AspNetCore.Razor.Tasks.GenerateStaticWebAssetsManifest.Execute()
ResultsMonitor.API C:\Program Files\dotnet\sdk\6.0.300\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets 411
Furthermore, on the new machine:
If I use JetBrains Rider 2022.1.1 to open the same project, it just builds and runs fine.
If I do a "dotnet build" from the terminal, build also succeeds.
What is wrong with Visual Studio 2022? I even uninstalled and reinstalled Visual Studio 2022 and the .NET 6 SDK for Visual Studio

problem on vscode on manjaro linux, error MSB4025:

the whole error
/home/ninjamanthing/C#/projak/HELLP.cs : error MSB4025: The project file could not be loaded. Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
/home/ninjamanthing/C#/projak/HELLP.cs : error MSB4025:
i cant find anything on it online, and i dont know enough about C# to try to solve this problem
i am very new to C#
I faced a similar issue I think:
Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
/home/aloisdg/Source/extLauncher/ExtLauncher/ExtLauncher.fsproj : error MSB4025: The project file could not be loaded. Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
/home/aloisdg/Source/extLauncher/ExtLauncher/ExtLauncher.fsproj : error MSB4025:
Build FAILED.
/home/aloisdg/Source/extLauncher/ExtLauncher/ExtLauncher.fsproj : error MSB4025: The project file could not be loaded. Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
/home/aloisdg/Source/extLauncher/ExtLauncher/ExtLauncher.fsproj : error MSB4025:
0 Warning(s)
1 Error(s)
In my case, the issue was because I have a not valid fsproj. Look if your csproj is correct. Check your diff if you are using a source manager like git. Then, you can pass it through an xml validator then check it line by line with the doc. Good luck.

Xamarin project opens up with error: Could not load file or assembly 'System.Collections.Immutable'

I'm working in a github cloned Xamarin project. When I open up the project it displays the following error:
Severity Code Description Project File Line Suppression State
Error Could not load file or assembly 'System.Collections.Immutable,
Version=1.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of
its dependencies. The located assembly's manifest definition does not match
the assembly reference. (Exception from HRESULT: 0x80131040) ProjectName
C:\Users\USER\.nuget\packages\refit\4.6.30\build\netstandard1.4\refit.targets
29
I've tried cleaning the project, deleting the bin/obj folders and I've cleared my nuget packages and restored. All of these solutions didn't work and when trying to rebuild the project it displays another error:
Severity Code Description Project File Line Suppression State
Error The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'ProjectName,
Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist
in the Mono for Android profile?
File name: 'ProjectName.dll'
at
Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.
<ExecuteInstantiatedTask>d__26.MoveNext() ProjectName.Android
I'm using Visual Studio Community 2017 version 15.8.8 and Xamarin.Forms
2.5.0.280555
The project that I'm working on works on other pc's from co-workers so I think it has to do with my VS installation. I tried to reinstall VS but this resulted in the same errors.

Passing the paths of nuget installed assemblies to mono runtime

I have Visual Studio project that I am trying to get running with Mono.
I could install all dependencies using
mono nuget.exe install
and compile my application using
mcs -r:RestSharp.105.2.3/lib/net46/RestSharp.dll \
-r:JWT.1.3.4/lib/3.5/JWT.dll \
-r:jose-jwt.2.2.0/lib/net461/jose-jwt.dll \
-r:Newtonsoft.Json.10.0.1/lib/net45/Newtonsoft.Json.dll \
Program.cs
Now I am trying to run the application using
mono Program.exe
Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
File name: 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.
File name: 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
So how do you pass the path to the assemblies to the Mono runtime similar to the compiler?
I tried to set $MONO_PATH but this is not working and not recommended for Production.
The overall question how the mcs compiler and the mono runtime could get the information directly from the installed packages (using nuget.exe).

Xamarin Android: Self-contradicting dependency requirements?

When trying to build my Android project in Xamarin Studio, I keep getting errors like these:
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2):
Error: Exception while loading assemblies: System.IO.FileNotFoundException:
Could not load assembly 'Mono.Android.Support.v4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'.
Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Mono.Android.Support.v4.dll'
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute() (Akva20150407)
-
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2):
Error: Exception while loading assemblies: System.IO.FileNotFoundException:
Could not load assembly 'Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, PublicKeyToken='.
Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Xamarin.Android.Support.v4.dll'
at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute() (Akva20150407)
-
C:\progge\Apper\Akva20150407\Akva20150407\Act_MainGUI.cs(29,29):
Error CS0433: The type 'Android.Support.V4.App.FragmentActivity' exists in both
'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v5.0\Mono.Android.Support.v4.dll' and
'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v5.0\Xamarin.Android.Support.v4.dll'
(CS0433) (Akva20150407)
I must add Xamarin.Android.Support.v4 to the MonoAndroid folder, or it will complain that it can't find it.
I must add Mono.Android.Support.v4 to the MonoAndroid folder, or it will complain that it can't find it.
If I add both, it will complain that FragmentActivity can be found in both packages.
The packages were installed via NuGet.
It looks very much self-contradicting.... What on Earth am I supposed to do to get this working??
Upgrade your Xamarin Studio
This bug was fixed in Xamarin Studio: 5.7.0.436.
See bug report: https://bugzilla.xamarin.com/show_bug.cgi?id=24276

Categories

Resources