-2

Solution That one line in .csproj file solved the problem.

  <Import Project="..\packages\Microsoft.VisualStudio.SlowCheetah.3.0.61\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.0.61\build\Microsoft.VisualStudio.SlowCheetah.targets')" />

------------------------------------------------------------------

How could I use SlowCheetah at an ASP.NET Core 7 Web API ?

I have the following settings in my .csproj file:

<Target Name="Transform" BeforeTargets="_TransformAppSettings;_TransformWebConfig">
    <ItemGroup>
      <ScFilesToTransform Remove="@(ScFilesToTransform)" />
      <ScWapPubProfileFullPath Include="$(WebPublishProfileFile)" />
    </ItemGroup>
    <PropertyGroup>
      <ScPubProfile Condition="'$(ScPubProfile)' == '' and '@(ScWapPubProfileFullPath)' != ''">%(ScWapPubProfileFullPath.Filename)</ScPubProfile>
    </PropertyGroup>
    <ItemGroup>
      <ScFilesToTransform Include="@(None);@(Content);@(Resource);@(EmbeddedResource)" Condition=" '%(TransformOnBuild)' == 'true' ">
        <SourceFile>%(FullPath)</SourceFile>
        <TransformFile>%(RelativeDir)%(Filename).$(Configuration)%(Extension)</TransformFile>
        <DestinationFile>$(OutDir)%(RelativeDir)%(Filename)%(Extension)</DestinationFile>
        <DestinationFile Condition="'%(Link)' != ''">$(OutDir)%(Link)</DestinationFile>
        <PublishDestinationFile>$(PublishDir)\%(RelativeDir)%(Filename)%(Extension)</PublishDestinationFile>
        <PublishDestinationFile Condition="'%(Link)' != ''">$(PublishDir)\%(Link)</PublishDestinationFile>
        <PublishTransformFile>%(RelativeDir)%(Filename).$(ScPubProfile)%(Extension)</PublishTransformFile>
      </ScFilesToTransform>
    </ItemGroup>
    <ItemGroup>
      <_ScPublishDirsToCreate Include="@(ScFilesToTransform -> '%(PublishDestinationFile)')" Condition="Exists('%(TransformFile)') or Exists('%(PublishTransformFile)')" />
    </ItemGroup>
    <MakeDir Directories="@(_ScPublishDirsToCreate->'%(RelativeDir)')" Condition=" !Exists('%(RelativeDir)') " />
    <SlowCheetah.TransformTask Condition="Exists('%(TransformFile)')" Destination="%(PublishDestinationFile)" Source="@(ScFilesToTransform->'%(SourceFile)')" Transform="%(TransformFile)" />
    <SlowCheetah.TransformTask Condition=" Exists('%(PublishTransformFile)') and '$(ScPubProfile)'!='' and '$(ScPubProfile)' != '$(Configuration)'" Destination="%(PublishDestinationFile)" Source="@(ScFilesToTransform->'%(PublishDestinationFile)')" Transform="%(PublishTransformFile)" />
  </Target>

The error that I get:

The "SlowCheetah.TransformTask" task could not be loaded from the assembly C:...\Api\Microsoft.VisualStudio.SlowCheetah.dll. Could not load file or assembly 'file:///C:...\Api\Microsoft.VisualStudio.SlowCheetah.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. Calendar.Api C:...\Api\Calendar.Api.csproj

GrinGenius
  • 13
  • 2
  • The error seems to indicate that the SlowCheetah dll is not accessible at the reported path. Check the path where SlowCheetah is being loaded from is correct. – phuzi Aug 30 '23 at 14:10
  • See here for possible duplicate: https://stackoverflow.com/questions/19936476/the-slowcheetah-xdt-transformxml-task-could-not-be-loaded-from-the-assembly – phuzi Aug 30 '23 at 14:11
  • I update my question, because i solved it. – GrinGenius Aug 31 '23 at 13:59
  • You should really add an answer with the detail of what fixed it for you (you can accept it too) rather than add the solution in the question. – phuzi Aug 31 '23 at 14:16
  • Do you really need SlowCheetah? It was a fudge for .net framework 4.5+ and isn't how .NET Core apps should be written. – Neil Aug 31 '23 at 15:55
  • Yes, i updated an application from .net framework to .net core, and we have a lot of .config file and etc... :/ – GrinGenius Sep 01 '23 at 11:40

1 Answers1

0

Solution That one line in .csproj file solved the problem.

 <Import Project="..\packages\Microsoft.VisualStudio.SlowCheetah.3.0.61\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.0.61\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
GrinGenius
  • 13
  • 2