tl;dr - custom .Net Core CLI tool not found when running as a pre-build step in Visual Studio Mac.
Full Story -
I have developed a custom .Net Core CLI tool, let's call it ConfigTool
. This tool was developed as a .Net Core console application, and was deployed as a nuget package in a private repository.
I have a .Net Core 2.0 project that references the nuget/tool in the csproj
as follows:
<ItemGroup>
<DotNetCliToolReference Include="My.Namespace.ConfigTool" Version="1.0.0" />
</ItemGroup>
When building the project, it restores the nuget package, and makes the CLI tool available as dotnet-configtool
. If I open up the terminal and navigate to my project directory and run the command dotnet configtool
it works as expected.
Now, I want this command to run as part of the build process. So, I added the following to the bottom of my csproj
.
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="dotnet configtool" />
</Target>
Problem:
When building the project from within Visual Studio Mac (Community Edition), I get the following error: No executable found matching command "dotnet-configtool"
.
Things tried
- Ran
dotnet configtool
from terminal in the project directory (windows). Success. - Ran
dotnet configtool
as a pre-build step in Visual Studio 2017 (windows). Success. - Ran
dotnet configtool
from terminal in the project directory (mac). Success. - Ran
dotnet build
from terminal in the project directory (mac). Success - Ran
dotnet configtool
as a pre-build step in Visual Studio Mac (community edition) (mac). FAILED.
I need this to work when running the solution from Visual Studio Mac.
Any ideas?