Visual Studio Publish/Deployment using File System with Power Shell Script

137 Views Asked by At

I have a Visual Studio 2019 project that I want to locally deploy to a network folder.
\\api\c$\inetpub\wwwroot The path requires a user name and password. Which The default visual studio publish does not prompt I simply get this error.

Severity Code Description Project File Line Suppression State Suppression State Error Unable to create directory "\\api\c$\inetpub\wwwroot\API\v1\". The user name or password is incorrect. API.Web.NET 0

  • What I am thinking is a power shell script that I could include in the project.
  • I could publish locally then copy to the network.
  • I want the user name and password to prompt so nothing is hard coded.

Any ideas or links would help

1

There are 1 best solutions below

0
On

You can use Get-Credential to prompt for both username and password.

$credential = Get-Credential
Copy-Item $yourlocalpublishpath $yourdestinationpath -Credential $credential