Microsoft.CodeAnalysis failed to load file - c#

I have downloaded sample Asp.net project from the git repository and try to build in the local machine VS 2017
below is the error it is showing
Error CS8032 An instance of analyzer
Microsoft.AspNetCore.Mvc.Analyzers.AvoidHtmlPartialAnalyzer cannot be
created from
C:\Users\avinash.nuget\packages\microsoft.aspnetcore.mvc.analyzers\3.0.0-alpha1-10670\analyzers\dotnet\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll
: Could not load file or assembly 'Microsoft.CodeAnalysis,
Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system cannot find the file
specified.. MusicStore E:\LearningTools\sampleapp\MusicStore-master\MusicStore-master\samples\MusicStore\CSC 1 Active
And here is the link for the git repo: https://github.com/aspnet/MusicStore for project reference.
What may be the issue in my machine or any missing file/lib in the framework?

It seems you do not have a dot.Net core SDK installed on your machine. Try installing the SDK and verify.
Thanks,
SK

Related

Could not load file or assembly 'VMware.Binding.WsTrust'

I am trying work with the VMWare SDK to create a Windows service in C# & .NET that automates launching and stopping virtual machines in the VMWare Workstation. I have downloaded the SDK and referenced the necessary dll files in my project.
VimClient c = new VimClientImpl();
ServiceContent sc = c.Connect(serverURL);
UserSession us = c.Login(username, password);
IList<EntityViewBase> vmList = c.FindEntityViews(typeof(VirtualMachine), null, null, null);
I'm attempting to run a basic example but when attempting to connect to the service, I encounter the following exception: "Could not load file or assembly 'VMware.Binding.WsTrust, Version=12.2.0.3593, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
When running as a Console Application in .NET Core, I get a similar exception: "Could not load file or assembly 'VMware.System.Private.ServiceModel".
I have tried copying over the runtime dll's from the nuget packages in my user folder and modifying my .csproj file to include these dll's, but I am still encountering the exceptions.
I am using .NET Framework 4.7.2. and my Target OS is Windows 10.
Assemblies added:
InternalVimService50.Wcf
InternalVimService70.Wcf
InventoryService55.Wcf
VimService.dll
VMware.Vim.dll
VmWare.Binding.Wcf
Stack Trace: StackTrace = " at
VMware.Vim.VimClientImpl.CreateClientChannel()\r\n at
VMware.Vim.VimClientImpl.Connect()\r\n at
VMware.Vim.VimClientImpl.Connect(String serviceUrl)\r\n at
VMWareServiceTest.Service1.OnElapsedTime(Object source, ElapsedEventArgs e) in C:\\Users\...
Exception Message:"Could not load file or assembly 'VMware.Binding.WsTrust, Version=12.2.0.3593, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
Any help would be greatly appreciated, thank you.
(First post on SO, but regular user of all the wonderful wisdom)
I just had this same issue trying to learn how to interact with vSphere using .Net.
Solved it by building vsphere-ws\dotnet\cs\samples\VMware.Binding.WsTrust from the VMware vSphere SDK, and then adding a refrerence to the resulting dll to my project.
I just loaded the Samples2012.sln in Visual Studio and build that particular project.
Involved versions:
PowerCLI 12.0.0 build 15947286 (Not sure if needed, but this is where I referenced VMware.Vim.dll)
VMware vSphere SDK 6.7U3 (6.7.0-14379537)
Visual Studio 2019 (16.8.2)
.NET Framework 4.8
Windows 8.1
Hopes this helps.

Installed SpecFlow.Allure but on server it doesn't work

I have a problem with SpecFlow Allure in local it works but on the server not. I have windows 2008 server and I using .tpl files for gradle. When I added to my tpl
the same settings as on app.config
`
<plugins>
<add name="Allure" type="Runtime"/></plugins><stepAssemblies>
<stepAssembly assembly="Allure.SpecFlowPlugin"/>
</stepAssemblies>`
but my server showed this error:
System.IO.FileNotFoundException : Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Ofc, if I removed from .tpl file information about Allure it works but my report is not created. Do you know any idea how to use it?
Cheers,
it's not about Allure, it's about .net standard 2.0 support. Please be sure your Jenkins agent is able to build .net std 2.0 projects.

Affdex .NET SDK - Could not load file or assembly Affdex or one of its dependencies

I'm having error when running WPF application with reference to C:\Program Files\Affectiva\Affdex SDK\bin\release\Affdex.dll
Exception:
Could not load file or assembly 'Affdex, Version=3.1.1.419, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format."
The WPF application is running under .Net Framework 4.5 and I'm running SDK version downloaded as AffdexSDK-3.1.1-419-win64.exe
According to this Affdex.dll depends on affdex-native.dll and loads it in runtime. Make sure that the latter is accessible to your program by adding it to your %PATH% variable or by adding it to your visual studio project. See example in AffdexMe source code.

Add Reporting.WinForms Reference to VS2015

I'm looking at adding the reference;
Microsoft.Reporting.WinForms
to my VisualStudio (2015) project but when I go to Add the Reference in the Solution Explorer I couldn't find it.
Eventually I added it through NuGet but now I am getting the error message;
Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
which leads me to believe I just haven't added the package properly. I've installed Microsoft SQL Server Data Tools through program features but still no luck.
What am I missing?
You can try by executing this into Package Manager Console
Install-Package Microsoft.Reporting.WinForms.v11

Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies

I have this exception generated on some user machines (~1 of 20):
Could not load file or assembly 'System, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The system cannot find the file specified.
I found several references to this error over the web and this site but nothing helped.
I have an add-in application which uses WCF to connect to the server. The add-in built with .NET Framework 3.5 with VS 2008.
The error is reproducible on one of the test machines in only one user account. I install my application and can only reproduce this from one account on this machine everywhere else it is working fine. Furthermore it is only reproducible with only one version of host application which I created add-in for (I assume because it uses differnet .NET Frameworks).
I have checked the fuse logs and I see the following:
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files\SolidWorks Corp\SolidWorks\sldworks.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = Home\User
LOG: DisplayName = System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///C:/Program Files/SolidWorks Corp/SolidWorks/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
So by some reasons it is trying to use v2.0.50727\mscorwks.dll loader to load the Version=4.0.0.0 of System.dll. On build machine I'm referring 2.0.0.0 version of System.dll.
I had this same problem - some users could pull from git and everything ran fine. Some would pull and get a very similar exception:
Could not load file or assembly '..., Version=..., Culture=neutral, PublicKeyToken=...' or one of its dependencies. The system cannot find the file specified.
In my particular case it was AjaxMin, so the actual error looked like this but the details don't matter:
Could not load file or assembly 'AjaxMin, Version=4.95.4924.12383, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f' or one of its dependencies. The system cannot find the file specified.
It turned out to be a result of the following actions on a Solution:
NuGet Package Restore was turned on for the Solution.
A Project was added, and a Nuget package was installed into it (AjaxMin in this case).
The Project was moved to different folder in the Solution.
The Nuget package was updated to a newer version.
And slowly but surely this bug started showing up for some users.
The reason was the Solution-level packages/respositories.config kept the old Project reference, and now had a new, second entry for the moved Project. In other words it had this before the reorg:
<repository path="..\Old\packages.config" />
And this after the reorg:
<repository path="..\Old\packages.config" />
<repository path="..\New\packages.config" />
So the first line now refers to a Project that, while on disk, is no longer part of my Solution.
With Nuget Package Restore on, both packages.config files were being read, which each pointed to their own list of Nuget packages and package versions. Until a Nuget package was updated to a newer version however, there weren't any conflicts.
Once a Nuget package was updated, however, only active Projects had their repositories listings updated. NuGet Package Restore chose to download just one version of the library - the first one it encountered in repositories.config, which was the older one. The compiler and IDE proceeded as though it chose the newer one. The result was a run-time exception saying the DLL was missing.
The answer obviously is to delete any lines from this file that referenced Projects that aren't in your Solution.
I got this after downgrading a project from .net 4.5 to .net 3.5.
To resolve I had to go in to the project - properties - settings window and delete all my settings, save the project, exit and restart visual studio, go back into project - properties -settings window and re-enter all my settings and their default values
This worked for me.
Go to Project->Propertied->Target Frawork->Change frame work like 3.5 to 4.0
I had the problem under Linux and I needed to install those. I don't know which one actually fixed the problem, but that error was gone after that:
apt-get install mono-utils mono-runtime-sgen mono-runtime-common \
mono-runtime-boehm mono-runtime-dbg mono-xbuild
I've seen this a couple times, and it is usually fixed by running a repair on .NET Framework (whichever version the application is trying to use).
You are using .net 4? - Maybe on the clients there is only the ".net framework 4 client profile" installed. Try to install full package!!
Download here
In my case, I was able to find issue with ScriptManager by setting Debug=true in web.config file
I answered too late but it has worked in my case.If you are facing this issue in your project please add the following line in your web.config :
<compilation batch="false" >
This worked in my case. If you already have compilation tag in your web.config then add only batch="false" property to it.
You can enable NuGet packages and update you dlls. so that it work.
or you can update the package manually by going through the package manager in your vs if u know which version you require for your solution.
Even I have experience some more strange things, I can see there is no dll in GAC from where the dll is loading but windows > Module shows system.dll version=4.0.0.0 loaded
i just changed my target .net framework and it worked .in my case i changed from .net 4.7 to .net 4.
Right click your solution and select properties
selct properties
Click Application >> Target Framework
FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
this is my problem. I installed system.configuration assembly in the project and other class libraries also. now the problem has gone.
am used net 6.0 with aspcore.report and problem like this happened with me
I installed system.configuration assembly in the server project problem solved

Categories