如何发布和预编译使用 GleamTech FileUltimate 的项目?

How to publish and precompile projects that used GleamTech FileUltimate in?

我在项目中使用了GleamTech FileUltimate 文件管理组件。 我将此程序集添加到我想使用 FileUltimate 的每个页面:

<%@ Register TagPrefix="GleamTech" Assembly="GleamTech.FileUltimate" Namespace="GleamTech.FileUltimate" %> 

或将此添加到 web.config 文件:

<httpModules>
   <add name="FileUploaderModule" type="GleamTech.Web.UploadModule"/>
</httpModules>

<pages>
  <controls>
    <add tagPrefix="GleamTech" assembly="GleamTech.FileUltimate" namespace="GleamTech.FileUltimate"/>
  </controls>
</pages>

当我想建立和运行网站时,给我留言:

存在构建错误。您想继续 运行 最后一次成功构建吗?

在这种情况下我选择是并且网站工作正常,但是当我想发布网站并在最后一步选择预编译时,编译器给出了一些错误:

错误:无法从 'Location' 属性 的字符串表示 '~/upload/fm/' 创建类型 'GleamTech.FileSystems.Location' 的对象。

错误:'System.Collections.ObjectModel.Collection`1[[GleamTech.FileUltimate.FileManagerRootFolder, GleamTech.FileUltimate, Version=4.5.0.0, Culture=neutral, PublicKeyToken=a05198837413a6d8]]'.

中不允许使用文字内容 ('')

错误:System.Collections.ObjectModel.Collection`1[[GleamTech.FileUltimate.FileManagerRootFolder, GleamTech.FileUltimate, Version=4.5.0.0, Culture=neutral, PublicKeyToken=a05198837413a6d8]] 必须有'GleamTech.FileUltimate.FileManagerRootFolder' 类型的项目。 'GleamTech:FileManagerAccessControl' 是类型 'GleamTech.FileUltimate.FileManagerAccessControl'.

有什么方法可以预编译我的项目并忽略这些错误吗? 我该如何解决我的问题?

此致。

供将来参考,

此问题已在 FileUltimate v5.3.8 中修复。问题仅出在“网站”项目上,而不出在“Web 应用程序”项目上。

Fixed: In Web Site projects, when you added FileManager markup in an aspx page and built the web site, the build failed with the following error message (actually 3 error messages but main one is this, others are consequences): Cannot create an object of type 'GleamTech.FileSystems.Location' from its string representation.

实际上旧版本有一个解决方法:

  1. 在 aspx 页面中仅包含此标记:

    <GleamTech:FileManager ID="fileManager" runat="server" 
                       Width="800"
                       Height="600" 
                       Resizable="True" />
    
  2. 然后在代码隐藏 aspx.cs 文件中,添加您的根文件夹和访问控制:

    protected void Page_Load(object sender, EventArgs e)
    {
        var rootFolder = new FileManagerRootFolder
        {
            Name = "A Root Folder",
            Location = "~/App_Data/RootFolder1"
        };
    
        rootFolder.AccessControls.Add(new FileManagerAccessControl
        {
            Path = @"\",
            AllowedPermissions = FileManagerPermissions.Full
        });
    
        fileManager.RootFolders.Add(rootFolder);
    }