我已经在我的项目定义如下生成后事件:如何获得Visual Studio来识别一个网络驱动器映射
if "$(ConfigurationName)"=="Release" ("$(ProjectDir)PostBuildRelease.bat" "$(TargetDir)")
所以,当我建立在释放模式的项目,执行以下.bat
文件:
PostBuildRelease.bat
CMD
SET parameter=%1
CD %1
ECHO "Copying temporary file..."
COPY FileDeleter.exe temp.exe
ECHO "Merging dependancies..."
"..\..\ILMerge.exe" /out:"FileDeleter.exe" /targetPlatform:"v4" "temp.exe" "Microsoft.WindowsAPICodePack.dll" "Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll" "Microsoft.WindowsAPICodePack.Sensors.dll" "Microsoft.WindowsAPICodePack.Shell.dll" "Microsoft.WindowsAPICodePack.ShellExtensions.dll"
ECHO "Removing temporary file..."
DEL temp.exe
它所做的就是装配复制到一个临时LO将所需的依赖关系合并到最终可执行文件FileDeleter.exe
中,然后删除该临时文件。
这工作得很好,当该项目被保存到本地驱动器,但该项目移动到网络驱动器后,我建立在Release模式时,得到这些错误:
'\\file\IT\Internal Apps\AppDev\Applications\WpfFileDeleter\WpfFileDeleter\bin\Release\'
CMD does not support UNC paths as current directories.
C:\Windows>"Copying temporary file..."
The system cannot find the file specified.
"Merging dependancies..."
'"..\..\ILMerge.exe"' is not recognized as an internal or external command,
operable program or batch file.
"Removing temporary file..."
Could Not Find C:\Windows\temp.exe
CMD抱怨不支持UNC路径。
但是,我知道有问题(\\File
)驱动器实际上是映射到Y:\
驱动器 - 这样我就可以通过瞄准Y:
而不是\\file\
导航到CMD的目录。
问题是 - 在我的所有项目移动到此网络驱动器后,如何让Visual Studio默认识别此驱动器映射?
给它绝对的网址。例如Y:\ FileDeleter.exe从驱动器开始。您应该拥有对该驱动器的读写权限。 – karman
如果以管理员身份运行,则只能访问映射为管理员的驱动器。 – 2016-11-10 11:36:14
@karman感谢您的评论 - 请参阅下面的答案和我的解决方案的评论。我不知道是否有任何方法让VS自动将当前目录设置为映射的URL – Bassie