How to connect to Shared Drive/Folder using a net command from MSBuild script?
Today, I gonna share the useful command that how we can connect to the shared drive/folder using a net command from MSBuild script.
- Install the MSBuildTasks package from NuGet package manager. My one is version 1.5.0.235.
- Import the package to your project file.
<Import Project="packages\MSBuildTasks.15.0.235\tools\MSBuild.Community.Tasks.Targets"/>
- Create the new Target to connect to the shared drive/folder.
<Target Name="ShareFolder">
<Exec Command="net use <drive>\\<servername>\<sharefolder> /user:<username> <password> "
</Target>
That’s it. I hope this will help. ๐
Photo: Internet