Service Start and stop in Universal Windows App - c#

I found the following Links in MSDN to help me start and stop the window services.
There is code snippet which tells it is possible to start and stop the service.
ServiceController sc = new ServiceController("Telnet");
if ((sc.Status.Equals(ServiceControllerStatus.Stopped))
|| (sc.Status.Equals(ServiceControllerStatus.StopPending)))
{
sc.Start();
}
else
{
sc.Stop();
}
sc.Refresh();
for this i need the System.ServiceProcess.dll the dll.
Namespace: System.ServiceProcess
Assembly: System.ServiceProcess (in System.ServiceProcess.dll)
I am trying to add this from NUget and got the error.
Type Script command :
Install-Package System.ServiceProcess.ServiceController -Pre
Error Message :
Install-Package : System.ServiceProcess.ServiceController 4.1.0-beta-23516 provides a compile-time reference assembly for System.ServiceProcess.ServiceController on UAP,Version=v10.0, but there is no run-time assembly compatible
with win10-arm.
At line:1 char:1
+ Install-Package System.ServiceProcess.ServiceController -Pre
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

This namespace System.ServiceProcess cannot be supported in uwp. We cannot find this .Net api in .NET for UWP apps.
Also you can add this reference manually by download the package from System.ServiceProcess.ServiceController. But you will still receive error when you run the code.

Related

Facing issue while installing Package using package Manager console in Visual Studio for ASP.NET MVC

While installing any package from Visual Studio using the Package Manager Console, I get an error - how to resolve it?
PM> Install-Package Microsoft.AspNet.MVC
Install-Package : Unable to find package 'Microsoft.AspNet.MVC' at source ''.
At line:1 char:1
Install-Package Microsoft.AspNet.MVC
CategoryInfo : NotSpecified: (:) [Install-Package], Exception
FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
In output window, it shows these messages:
[Package source] Unable to load the service index for source https://packagesource.
An error occurred while sending the request.
The remote name could not be resolved: 'packagesource'
Please add the package source from the option.
Tool -> Option -> Nuget Package Manager
Add new source and add name as you want and in source for add https://api.nuget.org/v3/index.json. and save it.

Nuget Package Manager - Update-Package NotSpecified error

I am trying to update my app's package to be compatible with .NET Framework 4.8
After I execute the Update-Package nuget command, I get an error mentioned in this link
Then after solving that issue, when I execute again the Update-Package, I'm now getting this error:
Executing nuget actions took 10.93 min
Update-Package : This collection is read-only.
At line:1 char:1
+ Update-Package -Reinstall -verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Update-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand
I don't know where to check this because it didn't say which library or files are affected by this error.
I tried to clean the packages, enabled verbose flag and everything that was suggested to the search but to no luck
Has somebody encountered the same and overcome this issue?
Really need help on this one.

Nuget package install command throws error : Install-Package Crystal Decision -Version 13.0.3500

I have been trying to install Crystal Decision version 13.0.3500.0 into my local code But I am getting error like
**Install-Package : Package 'CrystalReports.Engine 13.0.3500' is not found in the following
primary source(s):
'http://abcv.it.vbn.net/repository/nuget-drs-ms,C:\Program Files (x86)\Microsoft
SDKs\NuGetPackages\'. Please verify all your
online package sources are available (OR) package id, version are specified correctly.
At line:1 char:1
+ Install-Package CrystalReports.Engine -Version 13.0.3500
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId :
NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand**
any clue to solve this issue or error? Thanks in advance

Error on Enable-Migrations

I'm new with EF and I have an error when I try to run Enable-Migrations in PMC console :
Exception calling "LoadFrom" with "1" argument(s):
"Could not load file or assembly 'file:///...\pa
ckages\EntityFramework.6.0.1\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
At ...\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:780 char:62
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At ...\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:781 char:50
+ $dispatcher = $utilityAssembly.CreateInstance <<<< (
+ CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file:///...\packages\EntityFramework.6.0.1\tools\EntityFramework.PowerShell.dll' or one of its dependencies. Operation is no t supported. (Exception from HRESULT: 0x80131515)"
At ...\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1:809 char:31
+ $domain.CreateInstanceFrom <<<< (
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
I just ran into this on one of my co-worker's machine. The solution was:
Uninstall EF NuGet package
Manually remove Entity Framework sections from the Web.Config/App.Config files
Close Visual Studio
Re-open the solution in Visual Studio
Reinstall the EF NuGet Package
So openn the solution folder in file explorer, can you find the .dlls they are looking for in "Packages" folder then EntityFramework 6.0.1 folder? If not, there are two options:
Check your source control server, there is a possibility it was not downloaded to local workspace. if so, just get them manually from source control explorer if you are using TFS.
If the files were not on source control server either, I would recommend to uninstall EF 6.0.1 nuget, then manual delete the whole folder about ef in the Package folder above, and then reinstall it.
I had the same problem. My project was stored in a network drive. There are many security policies applied to my PC. I moved my project to the local hard drive, and the problem was solved.
It seems like "EntityFramework.Powershell.utility.dll" is tring to use some powershell functionality, and the system is preventing to execute such calls, maybe because the dll that is calling powershell is not a local file.
In your case, make sure that you do not have any security policy or system configuration that would prevent your system execute the problematical extension from a non local drive (EntityFramework.Powershell.utility.dll)
Faced similar problem. Reason of the problem was shifting of my code from one machine to another...Removing and then reinstalling entity framework solved the problem.
Update the Entity Package from Package Manager Console or browser.

Unable to resolve dependency 'html5shiv'

please help me to resolve this error:
PM> Install-Package twitter.bootstrap.mvc4.sample
Attempting to resolve dependency 'twitter.bootstrap.mvc4'.
Attempting to resolve dependency 'html5shiv'.
Install-Package : Unable to resolve dependency 'html5shiv'.
At line:1 char:16
+ Install-Package <<<< twitter.bootstrap.mvc4.sample
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
i want to install twitter.bootstrap.mvc4.samplen.nupkg offline.i add folder path to nuget manager in vs2012.
sorry for my bad english.
Try running Install-Package html5shiv first

Categories

Resources