【问题标题】:Azure Worker Role configuration issue while using SlowCheetah with custom config将 SlowCheetah 与自定义配置一起使用时出现 Azure Worker Role 配置问题
【发布时间】:2012-08-01 05:12:52
【问题描述】:

我们正在使用 Nlog 作为我们 Azure 应用程序的 Worker Role 的日志记录工具。 它需要 NLog.config 文件。我们安装了“SlowCheetah - XML Transforms”,并且有两个 Debug/Release 转换)。

解决方案确实成功重建。

但是当我尝试运行时,出现以下错误。 (我在我的一个 Windows 服务应用程序中使用了 nolog.config 的精确转换,它在那里运行良好)。

错误 163 项目列表“OutputGroups”中的项目“bin\Debug\NLog.config” 没有为元数据“TargetPath”定义值。为了使用 此元数据,或者通过指定来限定它 %(OutputGroups.TargetPath),或确保此列表中的所有项目 为此元数据定义一个值。 C:\程序文件 (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure 工具\1.6\Microsoft.WindowsAzure.targets 2299 5 Insight.CloudWeb

【问题讨论】:

    标签: configuration azure nlog azure-worker-roles slowcheetah


    【解决方案1】:

    我不知道这是否由 SlowCheetah 扩展完成,但您能否验证您的 *.csproj 文件是否包含与此类似的 AfterCompile 目标?

    <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    
    <UsingTask TaskName="TransformXml"
      AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
    
    <Target Name="AfterCompile" Condition="exists(’app.$(Configuration).config’)">
      <TransformXml Source="NLog.config"
        Destination="$(IntermediateOutputPath)$(TargetFileName).config"
        Transform="NLog.$(Configuration).config" />
      <ItemGroup>
        <AppConfigWithTargetPath Remove="NLog.config"/>
        <AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
          <TargetPath>$(TargetFileName).config</TargetPath>
        </AppConfigWithTargetPath>
      </ItemGroup>
    </Target>
    

    请查看 App.config 文件转换 下 Oleg 的博文 .Config File Transformation 了解更多信息。

    【讨论】:

    • 我认为你的建议只有在我完全移除 slowcheetah 的情况下才会奏效。一旦我无法使用 SlowCheetah 插件让它工作,我会尝试这样做。谢谢。
    【解决方案2】:

    我有一个解决办法。现在您应该能够使用 SlowCheetah 为 Azure Worker Roles 转换 app.config 以及其他 XML 文件。验证修复后,我会将更新发布到 VS 库。

    如果您想尝试修复,可以在 https://dl.dropbox.com/u/40134810/SlowCheetah/issue-44/SlowCheetah-issue-44.zip 下载更新的 VSIX。如果您有兴趣跟进此事,请使用issue #44

    【讨论】:

      猜你喜欢
      • 2017-11-20
      • 2020-08-28
      • 2017-06-14
      • 2021-06-16
      • 1970-01-01
      • 2021-08-11
      • 2011-05-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多