dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.21k stars 1.35k forks source link

MSBuild commandline seems to ignore publish properties #1901

Closed paleocomburo closed 5 years ago

paleocomburo commented 7 years ago

I'm trying to use msbuild to publish my application to a filesystem location. I've setup a profile from inside VS2017 and from there it works perfectly. When I run msbuild from the commandline: "msbuild application.sln /p:DeployOnBuild=true /p:PublishProfile=publishprofile" it builds the default "Debug|x86" target and nothing else. Nothing is published and the target in the publish profile is set to "release". When I specify a non-existing publish profile it still build like above, while I would expect an error telling me I specified a non-existing profile.

oexenhave commented 7 years ago

+1 I'm having the same issue. The following command builds correctly, but doesn't output anything to the deploy target. The exact same command works on a machine with VS2015 installed.

"C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" /t:Build;Publish TCA.Web\TCA.Web.csproj /p:DeployOnBuild=true /p:PublishProfile=Deploy.pubxml /p:Configuration=Release

I see the following in the build output, but unable to extract why it happens. _DeploymentUnpublishable: Skipping unpublishable project.

It works from the Visual Studio 2017 UI. I'm running build 15.0.0+26228.10

frbar commented 7 years ago

Same for me.

faemm commented 7 years ago

Same for me too,

ducseb commented 7 years ago

Same for me

ewilli commented 7 years ago

Same for me

frbar commented 7 years ago

Hi, still no news from Microsoft's guys? MSBuild 14 cannot build C# 7 code.

Is it possible to build with v15 and do the publish (and only the publish) with 14?

tran-barry commented 7 years ago

Same here

deadlydog commented 7 years ago

Same for me

jamest-iqmetrix commented 7 years ago

Same here.

vicp-iq commented 7 years ago

Ditto.

RyanMarcotte commented 7 years ago

Same here

andrewk-iq commented 7 years ago

Me as well

shkup commented 7 years ago

Same here. I try to run publish only (This method worked in previous versions) MSBuild /t:publish /p:PublishProfile= /p:PublishRootDir= /p:Configuration=Release

VincentLangevin commented 7 years ago

I'm also encountering the same problem

rainersigwald commented 7 years ago

I tried to reproduce this but don't think I did, on a new WebApplication type project created in VS2015 U3 and published on the command line from both VS2015 U3 and VS2017 15.1.

Can someone affected by this please post repro steps that are excruciatingly clear, for someone who has never used "publish" before like me? Ideally with a small repro project I could build in various ways, and explicit descriptions of the behavior you expect and what you see instead.

mattlwilliams commented 7 years ago

I'm not the original reporter, but experienced this issue attempting to configure a build agent without Visual Studio - using https://aka.ms/vs/15/release/vs_buildtools.exe - excerpt from PS script:

&.\vs_buildtools.exe `
  --add Microsoft.VisualStudio.Workload.MSBuildTools `
  --add Microsoft.VisualStudio.Workload.WebBuildTools `
  --includeRecommended --includeOptional `
  --passive `
  --norestart
frbar commented 7 years ago

Same here: that's ok with Enterprise VS 2017 on development machine, but nothing is published when running the same build command on a Jenkins box with the build tools (no VS installed).

adam-knights commented 7 years ago

Very annoying issue, has anyone found a workaround when using TFS?

We have the VS 2017 build tools installed on our build agent and see this issue with publishprofile + DeployOnBuild=true

ehaackXceligent commented 7 years ago

We can't move forward with msbuild 15 because of this.

doughless commented 7 years ago

I had this issue even with VS 2017 Enterprise installed. I had to re-run the Enterprise installer and select the component "ASP.NET and web development tools" in order to get web publish to work from the build server. Now that I think about it, this seems very similar to a problem I had back around VS 2012/2013 that required the Azure SDK to be installed for web publish to work (even though I didn't need to install any Azure components this time around).

ewilli commented 7 years ago

MSBuild 15.2 (26430.4) fixed the problem for me. (Just start the the installer; the update will then be available for install.)

ehaackXceligent commented 7 years ago

This also fixes the issue (via Chocolatey) for versions prior to 15.2: https://chocolatey.org/packages/visualstudio2017-workload-webbuildtools

[Edit: clarification]

ducseb commented 7 years ago

Same here, latest version of VS update fix the problem for me to.

rainersigwald commented 7 years ago

Glad to hear that updating seems to be working for folks. Please let us know if you're seeing this problem

If we don't hear a dissenting view, we'll close this as fixed . . .

faemm commented 7 years ago

It's ok for me with latest VS Build Tools. Just take care of adding Web development build tools by modifying installation.

Grandpappy commented 7 years ago

Had the same issue, and this worked for me. Something that confused me for a bit, is that the updater says 15.2 is installed, but the file version on MSBuild.exe is 15.1.1012.6693. I'm unsure if that's normal or not.

rainersigwald commented 7 years ago

@Grandpappy yes, that's the MSBuild version that shipped with VS15.2 (unchanged from 15.1).

mInternauta commented 7 years ago

Hey Guys, I Tested the MSBuild for VS2017 Preview (15.3) and the problem still the same...

emilegg commented 7 years ago

Hi, still have the same issue. :/

rainersigwald commented 7 years ago

@mInternauta @emilegg can you please detail exactly how your machine is set up, what you're doing, and how it differs from what you expect?

emilegg commented 7 years ago

@rainersigwald Windows 10, Microsoft Visual Studio Professional 2017 Version 15.2 (26430.13) Release, my command is : msbuild C:\project\myproject.csproj /p:DeployOnBuild=true /p:PublishProfile=MyPublishProfile and it seems to ignore the Publication profile. It always takes the default value.

adam-knights commented 7 years ago

Also see this issue still, upgraded from 15.1 to 15.2 using the installer and it did not fix this issue.

dasMulli commented 7 years ago

@adam-knights @emilegg @mInternauta does your build tools installation contain the web build tools?

vs_buildtools.exe --add Microsoft.VisualStudio.Workload.WebBuildTools
emilegg commented 7 years ago

@dasMulli Yes, it is installed.

emilegg commented 7 years ago

Here's the output errors (3) :

The OutputPath property is not set for project 'MyProject.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Pl atform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.

No destination specified for Copy. Please supply either "DestinationFiles" or "Destination Folder".

The "FindUnderPath" task was not given a value for the required parameter "Path".

emilegg commented 7 years ago

nvm, it worked with this command : bat "msbuild \"C:\\Test\\MyProject.csproj\" /P:DeployOnBuild=true /P:PublishProfile=\"Debug - PUBLISH PROFILE"\ /P:PublishProfileRootFolder=\"C:\\Test\\Properties\\PublishProfiles\" /P:AllowUntrustedCertificate=true /P:Platform=x86 /P:Configuration=\"Debug - CONFIGURATION PROFILE"\"

Thx ! :)

whiskytangofoxtrot commented 7 years ago

I am using v15.2 and still having this problem. I get the ...

_DeploymentUnpublishable: Skipping unpublishable project.

I have not installed the Web Build Tools workload. Is this required if I am just publishing to a folder and not doing a web deploy?

gandarez commented 7 years ago

I'm figuring out how to build all projects and create a package in the same instruction. Any thoughts?

jiriminx commented 7 years ago

I have tried v15.3 (exactly 15.3.409.57025) and the problem is still there: _DeploymentUnpublishable: Skipping unpublishable project.

michshat commented 7 years ago

I have run into that as well when building visual studio project from jenkins build

  1. C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe - Publishing would be ignore
  2. C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe - Published successfuly

I should mention the project is visual studio 2017 version upgraded from VS2010

MongkonEiadon commented 7 years ago

I have run following this; and It's work with deployed

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin>msbuild.exe "c:\MyProject\AnyProject.csproj" /P:DeployOnBuild=true /P:PublishProfile=Debug /P:AllowUntrustedCertificate=true /P:Configuration=Debug

siposz commented 7 years ago

Make sure that you use the proper MSBuild.exe. This: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin

Or if IDE (enterprise) installed: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin

If configure an MSBUILD step in a TFS server, set the path of the MSBUILD.exe manualy (Advenced/MSBuild/Specify location)

Using this: C:\Program Files (x86)\MSBuild\15.0\Bin will cause that deployment package creation FAIL.

deadlydog commented 7 years ago

We are using MSBuild 15.3 on our TFS build server and still having this problem. Here's the command we are using:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe "C:\Builds\_work\2\s\RQ.Shared\RQ.Shared.sln" /m /p:"DeployOnBuild=true" /p:"PublishProfile=C:\Builds\_work\2\s\BuildTools\PublishAppServicesScripts\Build\publishProfile-RQ.Shared.pubxml" /p:"SkipInvalidConfigurations=true" /p:"Configuration=Release" /p:"Platform=Any CPU" /verbosity:"minimal" /fileLoggerParameters:"LogFile=C:\Builds\_work\2\b\logs\RQ.Shared.msbuild.log" /flp1:"logfile=C:\Builds\_work\2\b\logs\RQ.Shared.msbuild.error.log;errorsonly"

MSBuild reports that the build completed successfully, but nothing shows up in the expected artifacts directory. We are building/publishing ASP.Net Web Application WCF services. The build servers only have VS 2017 installed on them.

For now we are going to revert back to using MSBuild v14 since the exact same command works there.

@rainersigwald please consider reopening this issue. Many people are still struggling with it, so I don't think the issue has been fully fixed.

If you require any other information from us, or would like us to test other parameters/configurations, please let me or @VincentLangevin know.

deadlydog commented 7 years ago

@rainersigwald it turns out that using the 64-bit MSBuild works correctly, but the 32-bit MSBuild does not create any artifacts to the output path.

64-bit path (works):

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64\MSBuild.exe

32-bit path (does not work):

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe

Hopefully that will give you guys a hint at the root problem so you can get this fixed in all versions of MSBuild.exe.

cumminsjp commented 7 years ago

I, too, am having this issue. With both the Bin\MSBuild.exe and Bin\amd64\MSBuild.exe.

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64>msbuild /ver
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

15.3.409.57025
dsplaisted commented 7 years ago

@andygerlicher

alexjustus commented 7 years ago

We're also experiencing this issue. Switching between the 32-bit and 64-bit versions of msbuild makes no difference.

ruant commented 7 years ago

I had the same issue. Using the build tools version of 2017 on the buildagent.
(Microsoft (R) Build Engine version 15.3.409.57025 for .NET Framework) Tried both x86 and x64.

My Publish profile is created in Visual Studio 2017, and is just a plain Filesystem copy, without any connectionString changes.

When I checked for Web Deployment Build Tools, I didn't have that installed. After I ran the installer and selected Web Deployment Build Tools from the UI installer
(also deselected .net core 1.0 dev tools, and selected .net framework 4-4.6 dev tools, .net framework 4.6.2 dev tools, .net framework 4.7 dev tools) it works as expected 👍
Files are being copied to the output dir specified in the publish profile (bin\Release\PublishOutput)

jadarnel27 commented 7 years ago

We were having this problem, and I can confirm that the solution outlined by @ruant fixed it for us as well.

mrtristan commented 7 years ago

for anyone out there that this may help, i was having this issue on a fresh installation of windows that only had VS 2017 installed. I installed VS 2015 on the machine and touched NOTHING else from how I was doing the build, and now it works... I don't get it, but it's suddenly working so i'm going to back away slowly from my machine now...