I have Web API developed in C# and .Net framework 4.6.
I have hosted it on a server in IIS and it is working fine. Whenever there is any change, I change the code, do the testing and publish it.
The publishing is done manually till now. The process which we follow is, right click on API project, select Publish
, select Publish Method as File System
,Target Location as Some path on local machine
, Configuration as Release
and click on Publish button.It generates a set of files in the target location. I will copy those set of files on to the server.
Now I want to automate this process. So for this I'm writing commands to do this. So for building the application, I'm using MSBuild.exe.
MSBuild.exe ProjectName.sln /t:Rebuild /p:Configuration=Release
For publishing I have used this command :
dotnet.exe publish ProjectName.sln /p:configuration=Release
But when I run this publish command, it is giving :
Nothing to do. None of the projects specified contain packages to restore.
So I have following questions:
- Why is it trying to restoring packages when I'm trying to publish. I'm already restoring packages using another command before building -->
Nuget.exe restore ProjectName.sln
. So I do not want it to restore anything. - Am I using the correct command to publish. If yes, how do I specify the target location?