How do I update AppxPackage in C# DISM API? - c#

I want to update AppxPackage with appxmanifest.xml with C# DISM API.
This is how I do it in powershell :
Dism /Online /Add-AppxPackage -DisableDevelopmentMode -Register "C\Program Files\WindowsApp\Microsoft.WindowsCalculator_10.1805.1201.0_x64__8wekyb3d8bbwe\AppxManifest.xml
Is it possible to do the same in C#? I don't want to just run the powershell command in C#.

Related

Calling net.tcp WCF service failed

I have wcf service running on localhost:53201 withing local IIS.
when I am trying to request this service I get exception:
Could not connect to net.tcp://localhost:53201/Calculator.svc. The connection attempt lasted for a time span of 00:00:04.1811447. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:53201.
I was trying to enable WCF services running powershell script:
#.NET Framework 3.5 (includes .NET 2.0 and 3.0)
#Windows Communication Foundation HTTP Activation
dism /online /enable-feature /featurename:WCF-HTTP-Activation /all
#Windows Communication Foundation Non-HTTP Activation
dism /online /enable-feature /featurename:WCF-NonHTTP-Activation /all
#.NET Framework 4.7 Advanced Services & WCF
dism /online /enable-feature /featurename:NetFx4-AdvSrvs /all
dism /online /enable-feature /featurename:NetFx4Extended-ASPNET45 /all
dism /online /enable-feature /featurename:WCF-Pipe-Activation45 /all
dism /online /enable-feature /featurename:WCF-MSMQ-Activation45 /all
dism /online /enable-feature /featurename:WCF-HTTP-Activation /all
dism /online /enable-feature /featurename:WCF-HTTP-Activation45 /all
dism /online /enable-feature /featurename:WCF-NonHTTP-Activation /all
dism /online /enable-feature /featurename:WCF-Services45 /all
dism /online /enable-feature /featurename:WCF-TCP-Activation45 /all
dism /online /enable-feature /featurename:WCF-TCP-PortSharing45 /all
The operation was completed successfully for all of them, nevertheless, it does not help.
Could you please advise me what I may doing wrong here or what else may I try?
Edit:
looks like I do not have following services in Services list:
but I do not know how to add them as all Windows Features I am aware I should I have already enabled as follow:

How to install sudo and mpicc in windows?

I want to run a mpicc code written in C#. But to run the same I'll have to install sudo apt install mpich and to do that I need sudo command in windows cmd window. I tried using git bash and installed gsudo but didn't work. Is there any other way to run my file?
Commands to use to run my file:
mpicc p_mpi.c -o p_mpi
mpirun -np 4 ./p_mpi
Commands I used before using the above and failed:
sudo apt install mpich
winget install gsudo
gsudo apt install mpich
sudo is a linux command for running a program as administrator. It can not be used in windows.
If you are using windows but need to use linux only programs i sugest trying out wsl.
apt is also a program that does not work in windows. It is a program used for installing and updating programs in debian based linux distributions.

How to create a (Azure CLI) command line application in Angular

How to a create command line (CLI) project. I like to add Azure CLI commands to end users in my Angular project. Presently I am tyring to do using C#. So please help me how to do CLI in Angular or C# to integrate my Azure CLI commands
You could run Azure CLI in C# like this:
string strCmdText;
strCmdText = "/C az login";
System.Diagnostics.Process.Start("CMD.exe", strCmdText);
/C: Carries out the command specified by string and then terminates.
Angular cannot directly run the CLI commands as this would be a security flaw in the browser.
If you were to acquire a user token from an app registration, you could call Microsoft Graph APIs on behalf of a user. Very detailed explanation on how to do this here: https://learn.microsoft.com/en-us/graph/tutorials/angular
The other option is to call a C# Web API and run Microsoft Graph or the Azure CLI from the web server. Microsoft Graph SDK is the preferred mechanism from C#, but you could also use System.Diagnostics.Process to launch and run Azure CLI commands.

ASP.Net v4.0 and ASP.Net v4.0 classic missing in IIS Application Pool list

I do not find ASP.NET v4.0 and ASP.NET v4.0 classic in IIS.
I have tried below:
1) Installing ASP.Net
2) Run aspnet_regiis.exe -ir in command prompt as administrator
3) Run dism /online /enable-feature /featurename:IIS-ASPNET45 /all in command prompt as administrator
Please let me know what I am doing wrong.
Thanks in advance!

How can I install .Net 3.5 on Windows 10?

I need to install .Net 3.5 so I can use SQL Server Express/Local Db in Visual Studio.
I have trawled the internet looking for answers and nothing works.
It got stuck on this all night, this is enabling .Net 3.5 from the Control Panel.
I even redownloaded Windows 10 and run this DISM command
DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:c:\sources\sxs
but it still hangs and won't do anything.
If anyone could help me out that would be super helpful
.NET 3.5 cant be install by internet. you have to use your installation DVD or ISO downloaded from Microsoft website.
use this command to install
DISM /Online /Enable-Feature /FeatureName:NetFx3 /Source:d:\sources\sxs /All /LimitAccess
d: should be the
ISO mapped drive if you use ISO file
DVD drive if you use installation DVD
Few important points.
If you use ISO file, There can be errors if you try to use a ISO from a network location.
If you download ISO from Microsoft web site careful about 32 bit and 64 bit.
Run command prompt as Administrator to run this command
If your command prompt hang without any response, probably it means Some windows updates installation is in progress. So restart the computer and try again.
Go to "Turn Windows feature on or off" window.If you installed properly, you can see .NET framework 3.5 is installed.
Here is the step by step guide I have written. http://codeketchup.blogspot.sg/2015/11/how-to-install-net-framework-35-on.html
If you have access to MSDN subscription, download the Windows 10 Features on Demand ISO, mount it and run this command:
DISM.EXE /Online /Add-Capability /CapabilityName:NetFx3~~~~ /Source:D:\
(where D: is the mounted ISO)
If this fails, run this command to add the files back to your Windows
DISM.EXE /Online /Add-Package /PackagePath:D:\Microsoft-Windows-NetFx3-OnDemand-Package.cab
and now go to the UI to enable the feature.
If you don't have your Windows installation media at hand or want it easier:
These are the methods without the commandline DISM command, which work interactively- for the first two you need current internet access:
Normally it is enough to start an application requiring .NET 3.5 and Windows will bring up a dialog for installation over internet.
Type "windows feature" in the magnifier (search) line besides the start button and switch to
Turn Windows features on or off
Control panel
Then you find the known dialog from previous versions to turn .NET 3.5 features on, etc. (At least I was unable to find it from new settings dialog without search.)
If you updated Windows 10, and you had .NET 3.5 activated before on Win 7 or 8.x, then you have to do nothing, it is also activated in Windows 10.
Here is the real offline "emergency" installer:
http://www.smart-arab.com/2013/12/install-net-on-windows-8-1-and-windows-10-offline/
Of course this is not the official way.
You need to go to add remove programs and then add features to windows, then select it from here. This will install .net 3.5 and 2.0
edit 1
Please open a command prompt (cmd.exe) as admin and run the following command to install .Net 3.5:
DISM /Online /Enable-Feature /FeatureName:NetFx3 /Source:d:\sources\sxs /All /LimitAccess
(replace D: with your mounted Win10 ISO)
In some environment, DISM fails to fetch the file (Proxy, network policies). The DISM command takes the files from the DVD and you're fine
1. Open CMD as an administrate
Command: Dism /online /enable-feature /featurename:NetFX3 /All /Source:D:\sources\sxs /LimitAccess
here D=partition name Mout
Open ISO file of windows 10 and type D where Partition.
Finally Open Windows Features and then you will see Net Framework 3.5 has been install and enable.

Categories

Resources