Search code examples
asp.netvisual-studiodeploymentpublish

UNC File System Target Location Publishes Instead to Local Filesystem


Specifying a UNC path as the Target Location for Visual Studio 2015 "File System" Publish Method (for example, "\\UNC\Path").

However, instead of publishing to the UNC path, Visual Studio publishes to a subdirectory of the project folder, on the local drive.

The Visual Studio Output window shows the following output:

...
1>Web App was published successfully file:///C:/Users/UserName/Source/Workspaces/Project_Main/Project/%E2%80%8B//UNC/Path
    1>
    ========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
    ========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

It appears Visual Studio 2015 transforms the UNC path into local file path listed above, which seems to include the Unicode character U+200B: ZERO WIDTH SPACE (%E2%80%8B), followed by the UNC path.

In Windows Explorer, I can navigate to the local file folder, verifying that the ZERO WIDTH PATH character indeed displays as a folder with a blank name.

Project represents an ASP.NET MVC 5 web application.

How do I successfully publish to a UNC path in the Target Location field?


Solution

  • It seems copying the text from a SharePoint 2013 wiki table introduced the leading Unicode ZERO WIDTH PATH character, which in turn seems to have confused Visual Studio into thinking the UNC path represented a local file path.

    I resolved the issue by manually typing the UNC path in cleartext, then copy/pasting that into the Target Location.

    Visual Studio now publishes correctly to the UNC path.

    Garbage in, garbage out.