尝试部署 C# 插件时 Web 资源名称不包含有效前缀

Webresource name does not contain a valid prefix when trying to deploy C# Plugins

我正在学习或自学如何在 Visual Studio 2012 年使用 CRM 开发人员工具为 CRM 编写插件代码。我正在为 crmlab 编写插件代码。在尝试部署我的 CRM 解决方案时,它一次又一次地给我带来这个错误:

Webresources 名称不包含有效前缀

我已经检查了它说有问题的行,但我找不到任何丢失或需要添加的东西。

<Target Name="WebResourcesDeploy" DependsOnTargets ="GetWebResourcesFromReferences">
<AddWebResource
            DiscoveryServer="$(CRMDiscoveryServer)"
            Port="$(CRMDiscoveryServerPort)"
            Scheme="$(CRMDiscoveryServerScheme)"
            Organization="$(CRMOrganization)"
            Password="$(CRMUserPassword)"
            UserName="$(CRMUserName)"
            Domain="$(CRMUserDomain)"
            SolutionName="$(CRMSolutionName)"

            Items="@(CRMWebResource)"
    XAPOutputs="@(_SilverlightXapFiles)"
    XAPReferences="@(_SilverlightApplications)"
    MSBuildProjectFullPath="$(MSBuildProjectFullPath)"        
                 />

请帮助我,因为这阻碍了我的学习进程!

这里还有一些对您有用的信息。Web Resources for Microsoft Dynamics CRM

Relative URL

When referencing a web resource from areas that do not support using the $webresource: directive, a relative URL can be used. To enable this, we recommend that you use a consistent naming convention for the web resources that reflect a virtual file structure.

The solution publisher’s customization prefix will always be included as a prefix to the name of the web resource. This can represent a virtual ”root” folder for all web resources added by that publisher. You can then use the forward slash character (/) to simulate a folder structure that will be honored by the web server.

MSDN 博客中的一些有用 Guidelines(这些也可以在 SDK 中找到):

  • Referencing web resources from one of our designers is straight forward and the designer will take care of doing the right thing when referencing the web resource
  • Referencing web resources from CRM component that don’t have a designer (e.g. Ribbon, Sitemap) should always use the $webresource
    directive
  • Referencing web resources from other web resources (e.g. an html page referencing a js library) should always use RELATIVE paths.

我知道这有点晚了。我最近遇到了同样的问题。我只是删除了 Visual studio 添加到解决方案中的默认 Silverlight 项目,并且能够成功部署插件。