System.Management.Automation.Powershell enable-psremoting is missing pwrshplugin.dll - c#

The following piece of code is from a project of mine that is doing something with PSRemoting. I encountered an issue as the following piece of code
ps.AddScript("enable-psremoting -force -skipnetworkprofilecheck");
await ps.InvokeAsync();
will cause the following error to happen
System.Management.Automation.ActionPreferenceStopException: 'The running command stopped
because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Cannot find path
'C:\Users\pa3ck\Desktop\MP\RemotePowerShell\RemotePowershell\bin\Debug\net6.0-
windows\runtimes\win\lib\net6.0\pwrshplugin.dll' because it does not exist.'
I assume I'm missing some NuGet package, but I have no clue which at this point
I have the following NuGet packages installed and active in the project:
Microsoft.PowerShell.SDK (7.2.7)
Microsoft.WSMan.Management (7.2.7)
Microsoft.WSMan.Runtime (7.2.7)
System.Management.Automation (7.2.7)

Related

AddictedCS SoundFingerprinting giving netstandard error

I am attempting to use AddictedCS SoundFingerprinting (https://github.com/AddictedCS/soundfingerprinting).
When I download any recent version and build with Visual Studio 2019 I get the expected output with no errors or warnings (SoundFingerprinting.dll).
The issue is that when I attempt to call functionality from the DLL in a .net console application I get errors relating to netstandard referencing.
I've attempted to add a new reference manually as the error message suggests, but get no further - same error occurs.
Here is my code, taken straight from the SoundFingerprinting example:
var hashedFingerprints = await FingerprintCommandBuilder.Instance
.BuildFingerprintCommand()
.From("C:/Users/Asher/Desktop/testSound.wav")
.UsingServices(audioService)
.Hash();
Here is the error log I am getting when compiling my console app with either mcs or csc:
C:\Users\Asher\Desktop\Raw_0.1>mcs TestProg.cs
-r:SoundFingerprinting.dll -r:protobuf-net.dll TestProg.cs(46,40): error CS0012: The type System.Object' is defined in an assembly that
is not referenced. Consider adding a reference to assembly
netstandard, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51'
C:\Users\Asher\Desktop\Raw_0.1\SoundFingerprinting.dll (Location of
the symbol related to previous error) Compilation failed: 1 error(s),
0 warnings
I attempted this on my desktop PC running Windows 10, and on my Surface Pro 6 running Windows 10. I also attempted this using VS2017. The result was the same each time.
Also tried to use the library in Unity3D which caused a crash with no prompt or stacktrace output.
To Reproduce
Use: Windows 10, Visual Studio 2019
Steps to reproduce the behavior:
Download latest release (v7.2.0-beta3)
Build libraries
Attempt to call functionality from SoundFingerprinting.dll via a console application
I encountered exactly the same problem today. What fixed it for me was simply downloading the latest version of protobuf-net from nuget:
Install-Package protobuf-net -Version 3.0.101
Also, please don't paste pictures of code but the code itself next time.

Visual Studio 2017 during build exited with code 9009 : error code MSB3073

I am trying to build the visual studio code and I get the following build error.
I searched for answers regarding the same topic. I already tried adding nuget.exe to Path variable. But nothing seems to work.
This is my error in the error list
MSB3073 The command "nuget.exe push -Source Application_Internal -ApiKey VSTS C:Users\Documents\LOCAL_NUGET_FEED\App.Util.*.*0.0.0*.nupkg" exited with code 9009
The corresponding line from csconfig file is
<Exec Command="NuGet.exe push -Source Application_Internal -ApiKey VSTS $(LOCAL_NUGET_FEED)\$(AssemblyName)*.*$(Version)*.nupkg " />
Any help would be much appreciated.
code 9009 : error code MSB3073
Agree with Klaus, 9009 in this situation means the nuget.exe can't be found during the build process. It seems that you have a MSBuild Exec task used to execute the nuget push command.
For msbuild exec task, it actually will call something like cmd.exe to execute the command. So if one command failed in Exec task or post-build-event, most of the time it indicates the command would fail in cmd.exe.
I already tried adding nuget.exe to Path variable
You can open cmd.exe and type nuget, if it displays many switchs about nuget.exe, it means your path variable is set well. But if it shows 'nuget' is not recognized as an internal or external command, it means you didn't add path of nuget.exe to Path Variable successfully. And that's why you got the 9009 in VS.
I Tried it, still getting the same error.
If the same error you mean is 9009, please check content above in #2. If the same error you mean is MSB3073, you need to check the error code, still code 9009 or xxx?
If you simply type nuget in cmd.exe and display many switches, then your path is set well. And I think the code 9009 will go away in VS if you rebuild the project. But it doesn't mean the MSB3073 error would go away. Only if nothing is wrong in your command NuGet.exe push -Source Application_Internal -ApiKey VSTS $(LOCAL_NUGET_FEED)\$(AssemblyName)*.*$(Version)*.nupkg the MSB3073 error would disappear.
For this situation, I mean the nuget.exe can be found. But it may have error when nuget.exe executed the push command, maybe the package not found, source invalid or what.
Note:
1.MSB3073 just means something is wrong with the command. (Perhaps not only one error in the command)
2.code 9009 means the nuget.exe is not found
So you may get MSB3073 and exited code 1 or what even after the nuget.exe can be found. At least for App.Util.*.*0.0.0*.nupkg, I think the nuget.exe didn't find your package.
Suggestion:
Please set the verbosity to Detailed and check the detailed log about why the build failed.
Some possibilities about why you get the MSB3073 after the code 9009 error go away(Examples for code 1):
I think you may get this error message for the wrong use of wildcard $(AssemblyName)*.*$(Version)*.

Facing issue on unity3d cmd line - executeMethod class could not be found

I am trying to build a Unity Project targeting Android platform from the cmd line. The C# script to build the project with the required options is titled PerformBuild.cs and is inside the project path. The class contains the method ConfigureBuildTestApp implemented.
$UNITY_PATH/Unity -quit -batchmmode -projectPath "$PROJECT_FINAL_PATH" -logFile -executeMethod PerformBuild.ConfigureBuildTestApp -buildTarget Android
The following error is observed in the build trace
executeMethod class 'PerformBuild' could not be found.
Argument was -executeMethod PerformBuild.ConfigureBuildTestApp
Any solution and/or reasoning for this problem? I followed the forum posts in the unity forum but none was helpful.
The script PerformBuild.cs
Compilation Errors were observed with the script above. Fixed the compilation errors and the revised script is shown below.
Revised PerformBuild.cs
The initial error for -executeMethod is still observed.
executeMethod class 'PerformBuild' could not be found.
Argument was -executeMethod
testIntegrationProject.PerformBuild.ConfigureBuildTestApp
(Filename:
/Users/builduser/buildslave/unity/build/Runtime/Utilities/Argv.cpp
Line: 295)
We had the "executeMethod class could not be found" error when a new plugin was used but was not present in the remote build server, causing all C# code to not compile, hence the error. Try manually building the project on the machine where you are building via command line and see if it succeeds.
Remove the namespace from class PerformBuild

dotnet restore unable to load shared library 'libproc' or one of its dependencies on Mac OS

I am following the tutorial for .NET on
https://www.microsoft.com/net/learn/get-started/macos
I installed the .NET SDK and create an app by using on macOS High Sierra Version 10.13.5:
~$ dotnet new console -o myApp
which gives me an error of:
The template "Console Application" was created successfully.
Processing post-creation actions...
Running 'dotnet restore' on myApp/myApp.csproj...
Unable to load shared library 'libproc' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES
environment variable: dlopen(liblibproc, 1): image not found
I tried to do
export DYLD_PRINT_LIBRARIES=/usr/lib/
before deleting the created folder and files, and I get a lot of printed statements that look like:
dyld: loaded: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.1.1/System.IO.Compression.Native.dylib
as well as the same error:
The template "Console Application" was created successfully.
Processing post-creation actions...
Running 'dotnet restore' on myApp/myApp.csproj...
Unable to load shared library 'libproc' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES
environment variable: dlopen(liblibproc, 1): image not found
I got it to work by using fs-usage to examine where does dotnet try to find libproc.dylib. In my case, I found that dotnet was trying to find libproc.dylib at ~/libproc.dylib, so I copied /usr/lib/libproc.dylib to ~/libproc.dylib and dotnet worked.
I think this is not a satisfactory answer so if anyone knows why dotnet was not looking for libproc.dylib at /usr/lib/libproc.dylib, please help me out. Thank you!
I noticed that my comment only worked when I started pwsh in ~.
I created a symlink in /usr/local/microsoft/powershell/6 that points to libproc.dylib:
/usr/local/microsoft/powershell/6$ sudo ln -s /usr/lib/libproc.dylib libproc.dylib
PowerShell starts correctly in any directory.
This will likely need to be recreated when I upgrade PowerShell Core (via Homebrew Cask).
** edit **
I should have read the question more closely--it was about dotnet, not pwsh.

.NET project Nunit tests are failing during mono build

I'm pretty new to CI (from a brand new set up point at least). I created a project in Rider, using the default version of NUnit that is provided if you select to 'Create new NUnit Project', and I am now trying to set up an automated build for it using travis-CI.
The target .NET framework version of my project and test projects (confirmed in Project properties in Rider) is 4.5.
The version of Nunit I am using is the default version provided with Rider, 3.5.
Here is my .travis.yml build file:
language: csharp
solution: .sln
install:
- nuget restore FindWordsWithConcatenations.sln
- nuget install NUnit.Runners -Version 3.5.0 -OutputDirectory testrunner
script:
- xbuild /p:Configuration=Debug ./FindWordsWithConcatenations.sln
- mono ./testrunner/NUnit.ConsoleRunner.3.5.0/tools/nunit-agent.exe ./TestFindWordsWithConcatenations/bin/Debug/TestFindWordsWithConcatenations.dll
I confirmed on my own machine by running the nuget command that the test runner path should be correct, when I run the nunit-agent (via agent, agent-x86, or agent-console) I get the following error (locally, and on the server):
Unhandled Exception: System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
at System.Guid..ctor(String g)
at NUnit.Agent.NUnitTestAgent.Main(String[] args)
I've also tried running with no configuration mode specified, and with configuration mode of Debug and Release specified.
Unfortunately, the normal tactic of googling/stack overflow hasn't helped, I've seen this error in a few questions, but the cause never seems related to what I'm experiencing.
The last build of the pipeline is available to view here, all the builds thus far have failed, previous builds can be seen here.
Thanks in advance, I would be very grateful if someone had any idea about the cause of this issue, or how I could tackle the test running in a different way.
Solved it.
Updated the script section of the travis config to:
script:
- xbuild /p:Configuration=Debug ./FindWordsWithConcatenations.sln
- mono ./testrunner/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe ./TestFindWordsWithConcatenations/bin/Debug/TestFindWordsWithConcatenations.dll
So it's now running the correct console application. Also had to modify the test paths a bit for it to run on the server.

Categories

Resources