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 Task not compatible with .NET CLI #48

Closed
AlonCG opened this issue May 24, 2017 · 25 comments
Closed

SlowCheetah Task not compatible with .NET CLI #48

AlonCG opened this issue May 24, 2017 · 25 comments
Labels

Comments

@AlonCG
Copy link

AlonCG commented May 24, 2017

In an attempt to update my EF Core first database ... I run dotnet ef database update.

This results in the following error:

C:\Users\Alon.nuget\packages\microsoft.visualstudio.slowcheetah\3.0.61\build\Microsoft.VisualStudio.SlowCheetah.targets(83,5): error MSB4062: The "TransformTask" task could not be loaded from the assembly C:\Users\Alon.nuget\packages\microsoft.visualstudio.slowcheetah\3.0.61\build..\tools\Microsoft.VisualStudio.SlowCheetah.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. 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.

Others are experiencing this same exact issue ... from SO.

Any chance this project is being bit by the same thing that the SO mentions?

"DotNet" commands worked no problem before installing SlowCheetah. Any suggestions? (Which would also help the OP in the SO issue as well!)

@davilimap
Copy link
Member

It seems the problem here is that the path to the DLL was incorrectly built. There should be a backslash right after the build and before ... Here is the line in the targets that we use to build the path. This states that MSBuildThisFileDirectory should include the final backslash. This seems to be a problem with .NET CLI breaking this property.

@AlonCG
Copy link
Author

AlonCG commented May 25, 2017

Thanks @davilimap for the explanation ... do I need to wait for the cli to be updated? Is there anything I should be doing to move forward? (clone repo, make changes, figure how to use those changes in my project, etc)?

And thanks for all the work you have done on this.

@davilimap
Copy link
Member

I've been investigating this issue a bit more, haven't been able to reproduce it so far. A possible workaround would be to go into the SlowCheetah target file and edit the <SlowCheetahTaskPath>, adding a backslash after $(MSBuildThisFileDirectory).
If this is possible, could you try it and see if it works? That would help me to better identify the problem

@tpodolak
Copy link

tpodolak commented May 31, 2017

Hi
I've encountered similar issue as @AlonCG. Running dotnet build results in following message

C:\Users\Tomek.nuget\packages\microsoft.visualstudio.slowcheetah\3.0.61\build\Microsoft.VisualStudio.SlowCheetah.targets(83,5): error MSB4062: The "TransformTask" task could not be loaded from the assembly C:\Users\Tomek.nuget\packages\microsoft.visualstudio.slowcheetah\3.0.61\build..\tools\Microsoft.VisualStudio.SlowCheetah.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. 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. [C:\Users\Tomek\Documents\Visual Studio 2017\Projects\JsonTrasforms\JsonTrasforms\JsonTrasforms.csproj]

If you take a closer look at the error message you will notice that the path to SlowCheetah's targets is

C:\Users\Tomek\.nuget\packages\microsoft.visualstudio.slowcheetah\3.0.61\build\..\tools\Microsoft.VisualStudio.SlowCheetah.dll

As you can see all the backslashes are on place however it seems that .. syntax is not resolved as the parent directory. I've tried your suggestion @davilimap, however, adding additional backslash to SlowCheetahTaskPath didn't help - path was resolved as
C:\Users\Tomek\.nuget\packages\microsoft.visualstudio.slowcheetah\3.0.61\build\\..\tools\Microsoft.VisualStudio.SlowCheetah.dll.

I am running the build with following dotnet cli/sdk

dotnet --version
1.0.4

@tgobena
Copy link

tgobena commented May 31, 2017

Does this work for .net core? I added the hard code path for the SlowCheetahTaskPath path in the Microsoft.VisualStudio.SlowCheetah.App.targets file and I am seeing the following error from the command line. It is building fine in visual studio. I am getting error when I run it from command "dotnet publish --framework net462 --output "PACKAGE" --configuration Release"
Error:

C:\Users[user].nuget\packages\microsoft.visualstudio.slowcheetah\3.0.61\build\Microsoft.VisualStudio.SlowCheetah.App.targets(63,5): error MSB4062: The "TransformTask" task could not be loaded from the assembly C:\Users[user].nuget\packages\microsoft.visualstudio.slowcheetah\3.0.61\tools\Microsoft.VisualStudio.SlowCheetah.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

@davilimap
Copy link
Member

davilimap commented Jun 6, 2017

I've done some more investigating of this issue and it seems like I was mistaken with my original assessment of the problem being with backslashes (which was why I originally asked if adding it would fix the problem). That is also why I wasn't able to reproduce it.
The problem seems to be what is stated here and here where the .NET CLI doesn't have the same framework loaded as MSBuild, so it doesn't recognize the task. The fix on our side for this is to multitarget the task based on the framework. I'll change the name of this issue to track this problem. I'm unsure if there's a fix on your side that can be used right now, but if I find one, I'll post it here.

@davilimap davilimap changed the title Running "dotnet" commands on a project with SlowCheetah installed errors. SlowCheetah Task not compatible with .NET CLI Jun 6, 2017
@johnmurphy01
Copy link

I'm running a .NET 4.5 console application and I'm having the same issue. I originally was using the SlowCheetah VS Extension(VSIX) but decided to move to the NuGet package(2.5.48). I installed the NuGet package, uninstalled and Extension and I'm getting the same error as @AlonCG posted.

When I go to the packages folder for SlowCheetah, the DLL file name is SlowCheetah.dll and not Microsoft.VisualStudio.SlowCheetah.dll. That makes sense why it can't find the dll. I renamed the dll but the TransformTask task still cannot be loaded from the assembly.

I really need the ability to perform transforms on my App.config file via MSBuild. Hopefully this will be resolved soon.

@johnmurphy01
Copy link

Turns out there's a Nuget package for SlowCheetah and Microsoft.VisualStudio.SlowCheetah. I had them both installed it appears. Removed both and re-installed Microsoft.VisualStudio.SlowCheetah and my local project is building.

@jviau
Copy link
Member

jviau commented Aug 14, 2017

Yes, sorry about that @johnmurphy01. We renamed the packages and vsix to show that Microsoft has officially taken over this project.

@dozer75
Copy link

dozer75 commented Aug 23, 2017

What's the status for this one? I am using the Microsoft.VisualStudio.SlowCeetah package, but get the error as described by others. Since mbuild deployment doesn't work with runtime identifiers the only option is to use the dotnet cli commands, but this issue is blocking that workaround.

@mattfrear
Copy link

mattfrear commented Sep 13, 2017

It doesn't work for me either. I have a solution which has both .NET Standard and .NET Framework projects in it - the .NET Framework ones are using SlowCheetah to transform my app.config. It compiles fine in Visual Studio 2017.

When I dotnet build I see

Executing: "C:/Program Files/dotnet/dotnet.exe" build "Promotions.Management.sln" --configuration Release
/p:Version=1.0.2-local
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.

C:\code\vsts\Backlog\commerce-promotions-management\packages\Microsoft.VisualStudio.SlowCheetah.3.0.61\build\Microsoft.VisualStudio.SlowCheetah.App.targets(63,5): error MSB4062: The "TransformTask" task could not be loaded from the assembly C:\code\vsts\Backlog\commerce-promotions-management\packages\Microsoft.VisualStudio.SlowCheetah.3.0.61\build\..\tools\Microsoft.VisualStudio.SlowCheetah.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the <UsingTask> 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. [C:\code\vsts\Backlog\commerce-promotions-management\test\Management.FunctionalTests\Management.FunctionalTests.csproj]

@moffatdm
Copy link

moffatdm commented Oct 4, 2017

Many thanks for fixing this. Do you have an ETA as to when the next version that includes this fix will be pushed to NuGet?

@AHoran
Copy link

AHoran commented Dec 1, 2017

2 months have passed since the apparent fix was merged. Any ETA on moving to nuget?

@MarienMonnier
Copy link

I stumbled upon this issue while searching for the same issue but with another product, while building on VSTS (with dotnet publish, so not exactly the same case).
I don't know if this will help, but I succeeded in building my project by adding the Microsoft.Build.Utilities.Core nuget package to my .csproj file:
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.5.180" />

@martinoss
Copy link

@MarienMonnier Did this help in conjunction with SlowCheetah? For me it does not help...

@MarienMonnier
Copy link

@martinoss Sorry, as I told before, this was not linked to SlowCheetah. This issue was one of the few that I found with the same error as I had, and I thought maybe it could help...

@maxisam
Copy link

maxisam commented Feb 20, 2018

FYI @MarienMonnier 's solution doesn't work.

@jonathh21
Copy link

I too have hit this apparent issue..

note the presence of the '\2.5.48\build**..**\tools'

The "TransformTask" task could not be loaded from the assembly C:\Users<user>.nuget\packages\slowcheetah\2.5.48\build..\tools\Microsoft.VisualStudio.SlowCheetah.dll. Could not load file or assembly 'file:///C:\Users<user>.nuget\packages\slowcheetah\2.5.48\tools\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. InboundIntegrationPlatform C:\Users<user>.nuget\packages\microsoft.visualstudio.slowcheetah\3.0.61\build\Microsoft.VisualStudio.SlowCheetah.App.target

I'm going to try removing everything (again)..

@jonathh21
Copy link

I can report that the tip about Microsoft.VisualStudio.SlowCheetah vs (the more downloaded) SlowCheetah has paid dividends.

once I removed both of these and re-added just the Microsoft one it seemed ok.

@EricHurt
Copy link

Is there an update to this? The relative path is still appearing in the output for me: "build..\tools". I need a solution as soon as possible and the other options in this thread have not worked for me.

@mjurca
Copy link

mjurca commented Jun 11, 2018

Try adding package version: 3.1.61-pre
https://www.nuget.org/packages/Microsoft.VisualStudio.SlowCheetah/3.1.61-pre

@jonathh21
Copy link

Hi guys,

Much time has past - and we are/were having issues with these pesky transforms, that is actually getting them to transform at all on core projects.

Just installed the 3.1.61-pre and it fixes our json and xml woo's - however it doesn't seem to apply the publish profile transform - only the config name (eg .debug./.release.).

So before .publishprofilename.config/xml would be considered for a transform and it seems to not be now.

Also had an issue whereby it was caching/using a .previous config transform in /obj/ after I'd completely removed the .debug.config transform. Had to manually delete this file.

Anyone else experiencing this/these?

@daghb
Copy link

daghb commented Jul 4, 2018

3.1.61-pre immediately fixed my problem. Thanks.

@davilimap
Copy link
Member

@jonathh21 The caching is due to the new behavior introduced in version 3.1.61-pre. I think transforming despite the transform file being deleted could be a separate bug.
Can you try building/publishing your project with logging enabled (for example, running msbuild /t:Publish /v:diag) and checking for the SlowCheetah targets (ScApplyTransforms and ScApplyWebTransforms)?

@matthughes404
Copy link

I was getting the original error MSB4062: The "TransformTask" task could not be loaded from the assembly... in a large solution with both SlowCheetah 2.5.48 and Microsoft.VisualStudio.SlowCheetah 3.1.66 referenced across different projects. Building the solution with VS2017 would work fine, but running dotnet build -c Release or dotnet publish -c Release on a specific netcore csproj resulted in the error.

After removing SlowCheetah 2.5.48 and replacing with the MS-maintained 3.166 version, the error was resolved.

ttstanley pushed a commit that referenced this issue Nov 14, 2024
Add -y switch to choco install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests