8
votes

I want to publish my dotnet core app to IIS from mac. I use VS code for code writing and Dotnet Core 1.1 for publishing to local directory. (for example: bin/release/publish). There are compiled my files, ready to copy to IIS. On my IIS I currently have installed web deploy 3.6 and this is my VPS machine. Is there elegant way, how to copy files? The another way is using docker, but in this case I have the same problem. Generated docker file with docker publisher tool and I need to copy from mac os.

Thank you for your time.

2
There is no solid tooling yet, cross compilation is also troublesome. Once VS for Mac is ready I think it would be solved. Before that you should switch to Windows and publish from there.Lex Li
Thank you for your answer. Visual studio for Mac is ready, but without publish. It looks like, you can publish only to azure. Maybe, I can try it with gulp-rsync for now.Petr Tomášek
@LexLi So, VS for Mac really not support publish for now.Petr Tomášek
it is not. Compared to VS, VS for Mac has a long way to go (why it is a Preview). But Microsoft/Xamarin 's next milestone would be it after shipping VS2017.Lex Li
Not sure about VS Code but VS for Mac now has a publish to folder functionality. Publish to IIS is still pending though. You can track it's update from developercommunity.visualstudio.com/content/idea/351842/…sandiejat

2 Answers

8
votes

From a terminal window navigate to the folder where your .csproj file is. From there run 'dotnet publish -c release'. A folder called publish will be created in bin/Release/netcoreappX.X. You can copy those files to the appropriate directory on your server. If you need help setting up IIS, follow the link below.

https://docs.microsoft.com/en-us/aspnet/core/publishing/iis

You can also run 'dotnet publish -h' to see all of the different arguments you can pass to the publish command.

2
votes

Web Deploy (msdeploy.exe) seems to work in Mono, at least in WSL (Ubuntu 18.04). The tricky part is to extract the msi package somehow, which you can do easily on a Windows machine (you'll find the files in C:\Program Files\IIS\Microsoft Web Deploy V3).

Once you install Mono and obtain msdeploy.exe, just call the command, e.g.

mono msdeploy.exe -verb:sync -source:contentPath=/mnt/c/Data -dest:contentPath=test,ComputerName=https://example.com:8172/msdeploy.axd,UserName=WDeployAdmin,Password=PASSWORD,IncludeAcls=False,AuthType=Basic -enableRule:AppOffline -enableRule:DoNotDeleteRule -verbose -allowUntrusted:true

This lets you sync/copy the contents of /mnt/c/Data with the test web site in IIS on example.com with Web Deploy enabled.