I would like to simulate "Publish..." menu item from WCF Service project (or ASP.NET Web Application or...) context menu in Visual Studio 2008. I do not have a need to publish it to a running IIS instance, just to put the web content together with bin folder on some local dir. Is there any way to add it in post build events, or as a MSBuild task?
To deploy the app using a publish profile, execute the msbuild command from a Visual Studio Developer Command Prompt. The command prompt is available in the Visual Studio folder of the Start menu on the Windows taskbar. For easier access, you can add the command prompt to the Tools menu in Visual Studio.
On the computer where you have the ASP.NET project open in Visual Studio, right-click the project in Solution Explorer, and choose Publish. If you have previously configured any publishing profiles, the Publish pane appears. Click New or Create new profile. Select the option to import a profile.
Here is the answer, thanks to this link: http://codingcockerel.co.uk/2008/05/18/how-to-publish-a-web-site-with-msbuild/ So, I have just modified the .csproj file of web application, and wrote this into AfterBuild target (that was already there):
<Target Name="BeforeBuild">
<Message Text="##############Before build##################" Importance="high"/>
<RemoveDir Directories="publish"
ContinueOnError="true"/>
</Target>
<Target Name="AfterBuild">
<Message Text="##############After build##################$(OutputFolder)" Importance="high"/>
<MSBuild Projects="$(ProjectName).csproj"
Targets="ResolveReferences;_CopyWebApplication"
Properties="WebProjectOutputDir=publish\;OutDir=publish\bin\" />
</Target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With