I have some libraries built on C# .NET Core 3.1.
When I execute the command
dotnet build "core\core.csproj"
I get the following error
C:\Users\christos.nuget\packages\visual-stylecop.msbuild\4.7.59\build\Visual-StyleCop.MSBuild.Targets(107,5): error MSB4062: The "StyleCopTask" task could not be loaded from the
assembly
C:\Users\christos.nuget\packages\visual-stylecop.msbuild\4.7.59\build..\tools\StyleCop.dll.
Could not load file or assembly 'System.Windows.Forms,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
The system cannot find the file specified. Confirm that the
declaration is correct, that the assembly and all its
dependencies are available, and that the task contains a public class
that implements Microsoft.Build.Framework.ITask.
But when I use msbuild
& 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe' "core\core.csproj"
it finishes without problems.
Any idea why?
thanks in advance for any help
Related
When I type "dotnet build" the following error occurs:
CSC : error CS8032: An instance of analyzer Microsoft.Extensions.Logging.Generators.LoggerMessageGenerator
cannot be created from /Users/xuz1/.nuget/packages/microsoft.extensions.logging.abstractions/6.0.1/analyzers/dotnet/roslyn3.11/cs/Microsoft.Extensions.Logging.Generators.dll :
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
The system cannot find the file specified..
Build FAILED.
CSC : error CS8032: An instance of analyzer Microsoft.Extensions.Logging.Generators.LoggerMessageGenerator
cannot be created from /Users/xuz1/.nuget/packages/microsoft.extensions.logging.abstractions/6.0.1/analyzers/dotnet/roslyn3.11/cs/Microsoft.Extensions.Logging.Generators.dll :
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
The system cannot find the file specified..
I tried to add the package using:
dotnet add package Microsoft.CodeAnalysis --version 3.11.0
but it gives me this error:
error: nodename nor servname provided, or not known
Any idea how to fix this?
Solved the issue by changing microsoft.extensions.logging.abstractions version to v3.1.9 since I am using .net core version 3.1
So the problem is, I have .NET 6. Then I do dotnet restore. After that, I want to do dotnet format -v diag --report ./editor-report.json --verify-no-changes example.sln.
But after formatting I got that error:
Analysis complete in 2554ms.
Unhandled exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Then I think maybe I can just install that dependencies. But I can't.
dotnet tool install --global Microsoft.CodeAnalysis
/tmp/sf1h1yl0.gli/restore.csproj : error NU1212: Invalid project-package combination for Microsoft.CodeAnalysis 4.1.0. DotnetToolReference project style can only contain references of the DotnetTool type
The tool package could not be restored.
How can I fix it? By the way the .NET 5 scan is doing well.
I've noticed this same issue in GitHub Actions, but wasn't able to reproduce locally.
It seems, according to this GitHub issue, that it's related to having the version 6.0.200 of the SDK installed on your machine. The suggestions in that thread are to either rename 6.0.200 or uninstall it entirely, but I haven't found another workaround.
net core 2.0 console app on a schedule only problem is i have a .dll file - I have followed resources which say to put the 'Start-in' option to the path of project and this hasn't worked - however when I navigate to the folder with the dll and run dotnet name.dll in cmd it executes the console app fine.
Here is the error i'm getting
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
rsine provided the answer in his question Scheduling multiple .net core console apps.
Example of 'New Action' form
Program/Script dotnet
Add Arguments program.dll arg1
Start In E:\User\ProgramFolder
When I run dotnet xxx.DLL in Ubuntu 14.04 x64 the following problem occurs:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Microsoft.AspNetCore.Hosting.WebHostBuilder..ctor()
at Microsoft.AspNetCore.WebHost.CreateDefaultBuilder(String[] args)
at Teste.Program.BuildWebHost(String[] args).
Follow some configurations of my project:
Project.csproj
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeIdentifiers>win10-x64;ubuntu.14.04-x64</RuntimeIdentifiers>
I tried to place the missing package in Nuget and the same thing did not work.
Linux server owns NET CORE 2.
I checked if the DLL was on the server (and it was).
Does anyone have a suggestion?
I have added more details to them at https://github.com/dotnet/core/issues/902
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