Azure Worker Role configuration issue while using SlowCheetah with custom config

766 Views Asked by At

We are using Nlog as logging tool with our Worker Role of Azure app. It requires NLog.config file. We installed "SlowCheetah - XML Transforms", and have two Debug/Release transforms).

Solution does get rebuild successfully.

But when I try to run, I am getting following error. (I used exact transformation for nolog.config in one of my Windows service app, and it is working fine there).

Error 163 The item "bin\Debug\NLog.config" in item list "OutputGroups" does not define a value for metadata "TargetPath". In order to use this metadata, either qualify it by specifying %(OutputGroups.TargetPath), or ensure that all items in this list define a value for this metadata. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\1.6\Microsoft.WindowsAzure.targets 2299 5 Insight.CloudWeb

2

There are 2 best solutions below

1
On

I don't know if this is done by the SlowCheetah extension, but could you verify if your *.csproj file contains the AfterCompile target similar to this?

<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>

Take a look at Oleg's blog post .Config File Transformation under App.config File Transformation for more information.

0
On

I have a fix for this. Now you should be able to transform app.config as well as other XML files for Azure Worker Roles using SlowCheetah. Once I get the fix verified I will release the update to the VS gallery.

If you would like to try the fix you can download the updated VSIX at https://dl.dropbox.com/u/40134810/SlowCheetah/issue-44/SlowCheetah-issue-44.zip. If you are interested in following up on this please use the issue #44.