microsoft/slow-cheetah

The item "App.config" in item list "ScFilesToTransform" does not define a value for metadata "Link"

Bidthedog opened this issue ยท 7 comments

Recently upgraded a solution to VS 2019 and upgraded SlowCheetah to the latest package (Microsoft.VisualStudio.SlowCheetah.3.2.26). I'm getting the following error when building projects that use SlowCheetah:

The item "App.config" in item list "ScFilesToTransform" does not define a value for metadata "Link". In order to use this metadata, either qualify it by specifying %(ScFilesToTransform.Link), or ensure that all items in this list define a value for this metadata

The only references to SlowCheetah in the csproj file are as follows:

  <Import Project="..\..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
  </Target>

Then the transforms:

    <None Include="App.config">
      <SubType>Designer</SubType>
      <TransformOnBuild>true</TransformOnBuild>
    </None>
    <None Include="App.Debug-MyTransform.config">
      <DependentUpon>App.config</DependentUpon>
      <IsTransformFile>true</IsTransformFile>
      <SubType>Designer</SubType>
    </None>

One thing to note is that all the project build configurations are stored in another targets file and imported as follows:

<Import Project="$(SolutionDir)BuildConfigurations.targets" />

In case that's important :)

Any ideas? A bit stuck with a big migration :(

I thought this was related to the fact that the csproj references transformations for build configs that do not exist any longer (as per the answer in #198), but I have since deleted them (and marked those that I do not want to delete as <IsTransformFile>false</IsTransformFile>), but this still happens.

However, this only happens when I perform a completely clean build; delete the packages dir, nuget caches, delete the bin and obj dirs for all projects, then re-open VS, rebuild and bam... error.

If I subsequently close VS (After the initial "clean" build), re-open it and rebuild, the error goes away and all projects build properly. A rebuild in the same instance produces the same error.

I've read a few other potentially related issues that said they were copying files into the output dir (in the AfterBuild target) - I am also doing this (and cannot avoid it).

Interestingly, when I build the same solution against the VS2017 Azure DevOps hosted runner (vs2017-win2016) with a completely clean build directory, it builds fine. I do not have VS2017 locally to test this against I'm afraid.

In my case I had the same error in VS 2019 but I don't use SlowCheetah at all.
"Clean Solution" and then "Rebuild Solution" helped in my case even without restarting Visual Studio.

Had the same issue, and I cleaned and rebuilt the solution as @perepechin suggested, and that worked!

Had the same issue after deleting my packages folder to free up some hard drive space. Even deleting the bin and obj folders didn't fix it until I ran a "Clean Solution", then "Rebuild Solution".

I also faced this problem in VS2019 when moving to Azure DevOps recently.

ScFileToTransform

After Cleaning and then 'ReBuild' the project. The error is gone and able to run the solution.
My solution has nothing to do with slow-cheetah.

Thanks, @perepechin for the quick solution.

https://stackoverflow.com/questions/13500789/slowcheetah-not-transforming-file-on-build
this have solution and has been fix that for me (my project use slowcheetah)

In my case I had the same error in VS 2019 but I don't use SlowCheetah at all. "Clean Solution" and then "Rebuild Solution" helped in my case even without restarting Visual Studio.

This helped in my case as well. Thanks @perepechin