EasyHostingASP.NET | Best and cheap ASP.NET Core RC2 hosting in India. This week I ran into an issue when deploying a Service Fabric service where a library file was not being copied to the output directory. Since I am using ASP.NET Core for my API layer in the Service Fabric project, I had to go dig around to figure out how to get the file to copy to the deployment folder during the publishing of the ASP.NET Core application.
<strong><em>"note that this solution with project.json may change with as ASP.NET Core moves back to .csproj file".</em></strong>
What I learned is that in ASP.NET Core RC 2 you can add scripts to the prepublish and postpublish events by adding a scripts section to the project.json file. In my case I needed to copy a file to the deployment folder after the rest of the project as built.
"prepublish": ["<command1>, <command2>"],
"postpublish": [ "xcopy <pathtofile> %publish:OutputPath%" ]
Note that you can reference variables like %publish:OutputPath%. You can also supply multiple commands by separating them with a comma. As noted above this currently works in ASP.NET Core RC2 but might change when as we transition back to the .csproj file.
Best and Cheap ASP.NET Core 1.0 Hosting in India Click Here !
- ASPHostPortal vs Site5 – Best Windows ASP.NET Hosting Comparison - September 29, 2017
- Best , Cheap Umbraco 7.7.1 Hosting Recommendation - September 28, 2017
- ASP.NET Web Forms Connection Resiliency and Command Interception - September 27, 2017