CZEMacLeod / MSBuild.SDK.SystemWeb

This MSBuild SDK is designed to allow for the easy creation and use of SDK (shortform) projects targeting ASP.NET 4.x using System.Web.
MIT License
151 stars 8 forks source link

Visual Studio publish command does generate any output #12

Closed lscorcia closed 2 years ago

lscorcia commented 3 years ago

In a MVC application generated using the project template, when I activate the Publish command with a Folder profile, the process ends without any error, but the output folder is empty. It seems that no Publish step is actually executed - build log:

Build started...
1>------ Build started: Project: Test.Mvc, Configuration: Release Any CPU ------
1>
1>Restore operation started...
1>
1>5 libraries restored in 1,36 seconds
1>Test.Mvc -> C:\Users\me\source\repos\Test\Test.Mvc\bin\Test.Mvc.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 0 failed, 0 skipped ==========
fretje commented 3 years ago

Publishing from Visual Studio indeed seems to be still a problem... It might be that we will also need help from the Visual Studio Team for this, so good you created this issue at least as a starting point ;-)

Anyways... I think you can easily work around this for now by publishing with msbuild straight from the commandline. I use something like this for a project I'm working on:

msbuild "path\to\your\solution.sln" /t:rebuild ^
                    /p:Configuration=Release ^
                    /p:DeployOnBuild=True ^
                    /p:DeployDefaultTarget=WebPublish ^
                    /p:WebPublishMethod=FileSystem ^
                    /p:DeleteExistingFiles=True ^
                    /p:publishUrl="path\to\your\output\folder"

but I think you can also supply an existing publishing profile (xml file) as a parameter, if you have one of those...

bachratyg commented 3 years ago

See https://github.com/dotnet/project-system/issues/2670#issuecomment-740837305

Right-click publishing from VS still does not work and the pubxml has to be hand-crafted (or just reuse one from a non-sdk project). msbuild /t:Restore,Rebuild /p:DeployOnBuild=true /p:PublishProfile=FolderProfile.pubxml works fine for file system publish.

lscorcia commented 3 years ago

Thanks for the workaround! Maybe it's worth documenting this behavior in the readme? Anyway, I think the issue can be closed.

CZEMacLeod commented 3 years ago

@bachratyg @lscorcia I am looking to try and capture information from the issues into documentation. Documentation? I'm not sure of the best way to do so yet - but would like to get this information into the documentation, at which point I feel we could happily close the issue.