简体   繁体   English

如何配置.NET安装项目以将文件复制到网络映射的驱动器?

[英]How to configure .NET Setup project to copy files to network mapped drive?

I have created a Setup project in VS 2010 for a windows forms project. 我在VS 2010中为Windows窗体项目创建了一个安装项目。 The application installs to C:\\Program Files correctly. 该应用程序将正确安装到C:\\ Program Files。 I have some configuration files that needs to be copied to a network mapped drive (I:\\ drive). 我有一些配置文件需要复制到网络映射的驱动器(I:\\驱动器)。 How do I achieve this? 我该如何实现?

Below are the steps followed: 1. Setup project --> View --> File System 1. Add Special folder 2. Custom folder 3. Copied all the configuration files to the custom folder. 以下是执行的步骤:1.安装项目->视图->文件系统1.添加特殊文件夹2.自定义文件夹3.将所有配置文件复制到自定义文件夹。 4. Custom folder --> DefaultLocation (property) --> [I:]\\ 4.自定义文件夹-> DefaultLocation(属性)-> [I:] \\

Am I doing something wrong here? 我在这里做错什么了吗?

I don't believe you can do this for two reasons: 我不认为您可以这样做有两个原因:

  1. The install runs with the system account which doesn't normally have access to the network. 安装使用通常无法访问网络的系统帐户运行。

  2. Mapped drive letters are not system-wide. 映射的驱动器号不是系统范围的。 They are specific to the user context that created them, so the system account has no idea of an I: drive created by another user. 它们特定于创建它们的用户上下文,因此系统帐户不知道其他用户创建的I:驱动器。 A share mapping that doesn't use drives such as \\server\\share\\location might work if point 1 can be overcome. 如果可以克服第1点,则不使用\\ server \\ share \\ location等驱动器的共享映射可能会起作用。

In these case it's usually better to copy the files when your app first runs as part of a configuration step. 在这种情况下,通常最好在应用程序作为配置步骤的一部分运行时复制文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 .NET 设置项目 - 安装到共享网络驱动器 - .NET setup project - Installing to a shared network drive 如何在asp.net网站/页面上的映射驱动器中读取文件 - How to read files in a mapped drive on asp.net website/page 在Visual Studio 2015中通​​过映射的网络驱动器创建和加载ASP.NET项目失败 - ASP.NET project creation and loading failure in Visual Studio 2015 over mapped network drive 如何从安装项目中复制特定文件? - How to copy specific files from setup project? 使用FileInfo.CopyTo复制映射的网络驱动器的文件 - Copy file fo mapped network drive using FileInfo.CopyTo 以编程方式将文件夹复制并粘贴到映射的网络驱动器中 - Copy and paste a folder programmaticaly inside a mapped network drive 映射网络驱动器上的 FileSystemWatcher - FileSystemWatcher on mapped network drive 无法从 Windows 服务访问驱动器映射网络共享上的文件 - Cannot access files on drive mapped network share from a Windows service 枚举映射驱动器中的文件 - Enumerate files in mapped drive 如何在VS 2008安装项目中将文件复制到C:\\ temp? - how to copy files to C:\temp in VS 2008 setup project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM