Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to publish binaries in .net core

I am trying to self host a .net core MVC application. It is working fine with all .cs files. When I published it (dotnet publish -f netcoreapp1.0 -c release) through command window it is shows the following error:

No executable found matching "bower"

and I even tried publishing with VS. It generates the binaries. But when I do dotnet run in command prompt it I get this error message:

project file does not exist 'project.json'

Can anyone suggest how to do self hosting with binaries?

enter image description here

enter image description here

like image 733
sanjeev Avatar asked Jul 05 '16 14:07

sanjeev


People also ask

How do I publish a Visual Studio solution from the command line?

Basic command-line publishingThe default publish folder format is bin\Debug\{TARGET FRAMEWORK MONIKER}\publish\. For example, bin\Debug\netcoreapp2. 2\publish\. The dotnet publish command calls MSBuild, which invokes the Publish target.

Which of the following command will publish .NET core application?

The user can use the “dotnet publish” command to publish a NET Core application, the command provides few options using which the user can tweak the output of the command. For example, the dotnet publish –output “c:\output” command outputs the published artifacts into the c:\output directory.


1 Answers

When running the dotnet publish command from the command-line, you have to make sure that your path variable contains all the relevant locations.

If you do a publish command from within Visual Studio, and look at the output in the "Build" window, you will notice that it updates the path variable before running the publish command:

enter image description here

From the command line, you can accomplish this by doing something like SET Path=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External; be

In PowerShell you can set it as

$env:path += ";C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;"

You can also look at this GitHub issue: No executable found matching command "bower"

As for your dotnet run question, you have to execute this command in the same directory that contains the project.json file, or use the -p|--project option to specify the location of the project file. Type dotnet run --help on the command-line for more info.

like image 122
JC1001 Avatar answered Oct 20 '22 06:10

JC1001