简体   繁体   中英

Publish project with build in VS2012 Fails with "Skipping unpublishable project"

I am migrating current solution from VS2010 to VS2012, since web deployment projects are not supported i am trying "Publish" feature on the project.

My requirement is to run "Publish" on the project while running the build. This is a ".csproj" with publish method "File System" also on settings tab of publish i have "Precompile during Publishing" and "Merge all outputs into single assembly".

I can manually run publish by right clicking on project and selecting "Publish" and it gives desired single assembly and copies it to right location, i just need this to run on build

I have tried following to no avail

Adding single line to .csproj file

    <DeployOnBuild>true</DeployOnBuild>

tried adding following lines to .csproj

<FilesToIncludeForPublish>OnlyFilesToRunTheApp</FilesToIncludeForPublish>
<DeployOnBuild>true</DeployOnBuild>
<DeployTarget>Package</DeployTarget>
<PackageAsSingleFile>true</PackageAsSingleFile>

Command line

MSBuild C:\MyProj.csproj /p:DeployOnBuild=true /p:PublishProfile=WebDeploy /p:CreatePackageOnPublish=True /p:VisualStudioVersion=11.0

Above command results in

Build started 07/04/2014 14:01:05.
Project "C:\MyProj.csproj" on node 1 (default targets).
Build:
Running Publish
_DeploymentUnpublishable:
Skipping unpublishable project.
Done Building Project "C:\MyProj.csproj" (default targets).
Build succeeded.

I'm glad you solved your problem, but I kept ending up here with my own searches, and it definitely wasn't McAfee (or any antivirus software) that was getting in my way. So for anyone else who ends up here, here's what eventually worked for me:

I realized that I was doing /t:Publish instead of /t:Package on the command line. Switching that bypassed the "Skipping unpublishable project" step.

The final command line should look like this (formatted for readability):

MSBuild C:\MyProj.csproj 
   /p:DeployOnBuild=true 
   /p:PublishProfile=WebDeploy 
   /p:CreatePackageOnPublish=True 
   /p:VisualStudioVersion=11.0
   /p:OutputPath="bin\\"
   /t:Package

令我惊讶的是,它原来是McAfee 防病毒软件,它在这里搞砸了“发布”,我做的事情是正确的,并且在关闭 McAfee 的情况下一切正常,防病毒软件以某种方式阻止了 aspnet_compiler.exe 来预编译网站,并作为结果预编译和后续合并步骤(将 dll 合并为单个程序集)失败,希望没有人经历同样的痛苦才能找到这一点。

I had the same problem and the cause was this line in my .csproj:

<OutputType>WinExe</OutputType>

I changed it to be a Case Sensitive match with the rules in Microsoft.Common.targets:

<OutputType>winexe</OutputType>

I it worked!

Using MSBuild.exe command line, you can specify the output path like below: You will explore on c:\\Program Files(x86)\\MSBuild\\14.0\\Bin ,Then you run this command:

.\MSBuild.exe [path of your project]/[projectName].csproj /P:Configuration=Release /p:Platform=AnyCPU / p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:outdir="c:\output\\"  /p:VisualStudioVersion=14.0

Please pay attention that you must create the output folder. If you are going to build all projects on solution you have to use below command:

 .\MSBuild.exe [path of your project]/[solutionName].sln /P:Configuration=Release /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:outdir="c:\output\\"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM