New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSBuild commandline seems to ignore publish properties #1901
Comments
|
+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. It works from the Visual Studio 2017 UI. I'm running build 15.0.0+26228.10 |
|
Same for me. |
|
Same for me too, |
|
Same for me |
1 similar comment
|
Same for me |
|
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? |
|
Same here |
|
Same for me |
|
Same here. |
|
Ditto. |
|
Same here |
|
Me as well |
|
Same here. |
|
I'm also encountering the same problem |
|
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. |
|
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: |
|
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). |
|
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 |
|
We can't move forward with msbuild 15 because of this. |
|
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). |
|
MSBuild 15.2 (26430.4) fixed the problem for me. (Just start the the installer; the update will then be available for install.) |
|
This also fixes the issue (via Chocolatey) for versions prior to 15.2: https://chocolatey.org/packages/visualstudio2017-workload-webbuildtools [Edit: clarification] |
|
Same here, latest version of VS update fix the problem for me to. |
|
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 . . . |
|
It's ok for me with latest VS Build Tools. Just take care of adding Web development build tools by modifying installation. |
|
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. |
|
@Grandpappy yes, that's the MSBuild version that shipped with VS15.2 (unchanged from 15.1). |
|
Hey Guys, I Tested the MSBuild for VS2017 Preview (15.3) and the problem still the same... |
|
Hi, still have the same issue. :/ |
|
same error. vs 2017 last update |
|
We're also having this problem which is preventing us from upgrading our build agents to handle mixed projects (.net core + framework 4.5.1). Can I kindly ask someone from Microsoft team to share any details if this is a known bug / new behaviour and if there are other ways to publish Webapp from msbuild in command lines? |
|
Update: MSBuild version: |
|
But I got it working even inside a docker container. For me the trick was installing the recommended components from the build tools installer: & vs_buildtools.exe --quiet --wait --norestart --nocache --installPath C:\BuildTool `
--add Microsoft.VisualStudio.Workload.WebBuildTools;includeRecommended `
--add Microsoft.VisualStudio.Workload.MSBuildTools |
|
I'm using Visual Studio 2017 and have the same issue when I execute the following command The problem was fixed when I executed script in the |
|
I do have the same issue... Any solutions? |
|
I wish to execute in a build server... |
|
Adding @vijayrkn |
|
You can find documentation on how to use PublishProfiles from commandline here - https://github.com/aspnet/websdk#folder-publish Here is a sample project with a PublishProfile: MSBuild command to publish to a folder using the above publish profile: https://github.com/vijayrkn/dotnetpublishprofilesample/blob/7dac43543173b4ce908921106cc84d810c6dc623/PublishCommandline.txt I would be happy to take a look at the issue if some one can provide me a sample project & msbuild command that is not working. |
|
I'm also experiencing this. MSBuild 14 and 15. I used @rianjs's targets change in my process of fixing it, and now it works. But a minor issue: targets I build for the publish process execute during normal building now. Although this isn't a problem for me (it's just a webpack bundle I wanted to execute before publishing) it does slow down my builds that don't need to publish, and it could be a problem for others. I'm not sure why it's being triggered. |
|
Using Visual Studio Build Tools 2017 (15.7.4) same problem. The project Build using Jenkins MsBuild plugin (and create a a file with the bin of the C# programme) but it doesn't publish multiple web-services related. Using Visual Studio IDE to publish works ok but want to automate the process if the publishing is Skipped. |
|
I'm not sure this is related but when trying to provide the PublishProfile it is ignored when defined within a custom target, specifying the properties directly in the project element is working EDIT: Fixed code example, still not working when I run: only works if I explicitly pass the profile through the command line: |
|
Any movement or news from Microsoft on this or is Microsoft just gonna keep pretending this is not an issue? I provided a sample project & msbuild command that is not working a month ago and have not heard a single word back. Pretty much until this issue is fixed, automated deployment is dead for anything that needs to transform a web config as a part of that deployment using the latest versions of MSBuild. So thanks guys, great job! ;) You'd think that with all the releases for Visual Studio that MS puts out these days this issue would of been fixed by now. But nah, instead we got useless warnings instead like those ones about Resharper slowing down VS. This makes me wonder if this is nothing more than MS trying to keep people on Visual Studio by making it so you can only publish your applications via Visual Studio. P.S. May I suggest that the MSBuild team incorporates some form of regression testing into their development cycle in order to not break existing features when making changes? |
|
@admin-fsoft I'm guessing it's probably very low priority as MS probably pushing everyone onto their cloud TFS and build. |
|
@admin-fsoft - Sorry for not getting back to you sooner. I looked at the repro project that you shared. The issue is that the profile in the repro project only has This property is only used by VS to determine which configuration to change to as part of publish. MSBuild does not know about this property. If you add the following property to the publish profile, then it would work from both VS and commandline. or you can pass this in the commandline - The issue here is specific to configuration. You will notice that publish is honoring all other properties in the publish profile from the commandline (for e.g: it publishes to the publish folder specified in the profile). Hope this helps! |
|
There are a lot of other issues discussed here. Also the title seems to indicate that commandline publish is not honoring the profile at all. If you look at the repro project provided by @admin-fsoft (Thank you for providing the repro project) you will see that publish does honor the profile properties (for e.g: publishUrl, ExcludeApp_Data etc). Configuration and Platform are a little different. You will have to either set them in the profile as
|
|
Thank you for providing an answer and you are correct as this has resolved the problem with the provided test project. I am now going to go and create a stack overflow question regarding exactly this and answer it so nobody else has to wait 1 month to get an answer. Thanks again. |
|
@vijayrkn - Visual Studio itself is creating that parameter in the publish profile, when you select the configuration to use. If this parameter should not be used, then this seems like a bug in VS. |
|
I was having this problem, and after trying a lot of different things I managed to solve it. I'm using Build Tools(MSBuild v14.0) for building my project in a Jenkins job, and in my case the problem was that I was missing some Web Publishing Dlls. I was able to get them from here: https://www.nuget.org/packages/MSBuild.Microsoft.VisualStudio.Web.targets/14.0.0.3 Putting them on the following directories solved my problem: |
|
@rafabaldoni That wasn't it. For me, the problem was something specific in the csproj file. It was a very old .csproj and had been converted through several steps (I think it originally dates back to VS 2003). I ended up just creating a new default projects and copying all the files and settings to the new one. Then publish started working again. |
|
@efunkenbusch Yeah, maybe there are different problems that result in the same error... If someone is experiencing the same problem I had they might be able to solve it with my comment anyway. |
|
I meet the same problem. |
|
There really is one core problem with the SDK and msbuild... there's zero accountability of dependencies The csproj file since VS2010 is a mismash of msbuild targets that are yanked in via various ways, with zero dependency management. Then when msbuild moves from v14 to v15, it all breaks again, because your csproj file doesnt know to say "hey, I need the targets file from Microsoft.NET.SDK.v14.xxxx" with a package manager (I keep hoping nuget will finally figure out how to do proper package dependency management but keep getting disappointed year after year) Your core problem is usually this: Most of the time, your problem is missing Web.Application.targets file or a Web.Application.targets file that is a different version to what your csproj file is configured for. Not to mention, project upgrades in VS dont seem to deal with this, and leave the old configurations sitting around to muck up the new targets and again, we've traded DLL hell for TARGETS hell. The answer has always been nuget to some degree, yet has been very slow to get integrated properly due to MS internal emp lack of understanding of whats going on out here, and the opaque nature at how it all worked for a while... with MS finally putting everything up on github, there's a lot more transparency and visibility, and people in the real world able to say "um, guys... that just doesnt make sense beyond basic assumptions" |
|
Found an alternative. Adding a FileSystemPublish task after Publish helps. My command looks something like this. |
|
In my case I was dealing with an old web app that was created with an old version of VS I am guessing 2010 or 2012. It did not have project file, just a solution file. Same issue msbuild was ignoring the parameters when I passed the solution file as the parameter, so this is what I did.... msbuild website.publishproj /p:PublishProfile=OnCUWire_publish /p:DeployOnBuild=true /p:Configuration=Debug website.publishproj is a file that VS created instead of the regular csproj. So by passing it to msbuild was able to publish it as the profile indicated. |
|
I am going to close this issue as there are many different conversation going on here and I believe the original question has been addressed by Vijay earlier in the thread. |
|
First, thank you @richardszalay Quoting the answer of the link above:
|
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.
The text was updated successfully, but these errors were encountered: