Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlowCheetah 'File not found' issue when publishing to the file system using msbuild #284

Open
trousyt opened this issue Sep 1, 2023 · 1 comment

Comments

@trousyt
Copy link

trousyt commented Sep 1, 2023

I'm using SlowCheetah 4.0.50 and msbuild 17.5.1 on a project using PackageReference.

I'm using msbuild from the command line and publishing to the file system and it seems as though the target ScApplyWebTransforms runs before the files have been copied to obj{Config}\Publish\PublishTmp. Then when the ScApplyWebTransforms target runs, it's unable to find the files to transform in PublishTmp and errors with a FileNotFoundException.

Task "SlowCheetah.TransformTask" (TaskId:47)
  Task Parameter:Source=obj\Release\Package\PackageTmp\log4net.config (TaskId:47)
  Task Parameter:Destination=obj\Release\Package\PackageTmp\log4net.config (TaskId:47)
  Task Parameter:Transform=log4net.Production (Local Publish).config (TaskId:47)
C:\Users\trparkin\.nuget\packages\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.Web.targets(95,5): error MSB4018: The "SlowCheetah.TransformTask" task failed unexpectedly.
 [C:\Projects\TFS-Git\HNVOD\src\VODTime\VODTime.csproj]
C:\Users\trparkin\.nuget\packages\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.Web.targets(95,5): error MSB4018: System.IO.FileNotFoundException: File not found [C:\Proje
cts\TFS-Git\HNVOD\src\VODTime\VODTime.csproj]
C:\Users\trparkin\.nuget\packages\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.Web.targets(95,5): error MSB4018: File name: 'obj\Release\Package\PackageTmp\log4net.config
' [C:\Projects\TFS-Git\HNVOD\src\VODTime\VODTime.csproj]
C:\Users\trparkin\.nuget\packages\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.Web.targets(95,5): error MSB4018:    at Microsoft.VisualStudio.SlowCheetah.JsonTransformer.
IsFileSupported(String filePath) [C:\Projects\TFS-Git\HNVOD\src\VODTime\VODTime.csproj]
C:\Users\trparkin\.nuget\packages\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.Web.targets(95,5): error MSB4018:    at Microsoft.VisualStudio.SlowCheetah.TransformerFacto
ry.<>c__DisplayClass1_0.<GetTransformer>b__0(ITransformer tr) [C:\Projects\TFS-Git\HNVOD\src\VODTime\VODTime.csproj]
C:\Users\trparkin\.nuget\packages\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.Web.targets(95,5): error MSB4018:    at System.Linq.Enumerable.FirstOrDefault[TSource](IEnu
merable`1 source, Func`2 predicate) [C:\Projects\TFS-Git\HNVOD\src\VODTime\VODTime.csproj]
C:\Users\trparkin\.nuget\packages\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.Web.targets(95,5): error MSB4018:    at Microsoft.VisualStudio.SlowCheetah.TransformerFacto
ry.GetTransformer(String source, ITransformationLogger logger) [C:\Projects\TFS-Git\HNVOD\src\VODTime\VODTime.csproj]
C:\Users\trparkin\.nuget\packages\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.Web.targets(95,5): error MSB4018:    at Microsoft.VisualStudio.SlowCheetah.TransformTask.Ex
ecute() [C:\Projects\TFS-Git\HNVOD\src\VODTime\VODTime.csproj]
C:\Users\trparkin\.nuget\packages\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.Web.targets(95,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft
.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Projects\TFS-Git\HNVOD\src\VODTime\VODTime.csproj]
C:\Users\trparkin\.nuget\packages\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.Web.targets(95,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstant
iatedTask>d__26.MoveNext() [C:\Projects\TFS-Git\HNVOD\src\VODTime\VODTime.csproj]
Done executing task "SlowCheetah.TransformTask" -- FAILED. (TaskId:47)

The target depends on PipelinePreDeployCopyAllFilesToOneFolder which looks like it should run before, not after ScApplyWebTransforms to give it a chance to copy the files.

Target "ScApplyWebTransforms: (TargetId:89)" in file "C:\Users\trparkin\.nuget\packages\microsoft.visualstudio.slowcheetah\4.0.50\build\Microsoft.VisualStudio.SlowCheetah.Web.targets" from project "C:\Project s\TFS-Git\HNVOD\src\VODTime\VODTime.csproj" (target "PipelinePreDeployCopyAllFilesToOneFolder" depends on it):

If I modify the Microsoft.VisualStudio.SlowCheetah.Web.targets file and comment out 'ScApplyWebTransforms;' in the PipelinePreDeployCopyAllFilesToOneFolderDependsOn property everything works:

<!-- Required for File System -->
<PipelinePreDeployCopyAllFilesToOneFolderDependsOn>
  $(PipelinePreDeployCopyAllFilesToOneFolderDependsOn);
  <!--ScApplyWebTransforms;-->
</PipelinePreDeployCopyAllFilesToOneFolderDependsOn>
@trousyt
Copy link
Author

trousyt commented Sep 7, 2023

For anyone experiencing the same issue, I started importing the following targets file to fix it.

<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="FixSlowCheetahFileSystemPublish" BeforeTargets="BeforeResolveReferences">
    <PropertyGroup>
      <PipelinePreDeployCopyAllFilesToOneFolderDependsOn>
        $([MSBuild]::Unescape($(PipelinePreDeployCopyAllFilesToOneFolderDependsOn.Replace('ScApplyWebTransforms', ''))))
      </PipelinePreDeployCopyAllFilesToOneFolderDependsOn>
    </PropertyGroup>
  </Target>
</Project>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant