Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS Build Server cannot get publish profile to work: "Can't find the valid AspnetCompilerPath"

I have a Solution with a bunch of Web Projects and i want my build server to automatically create packages for each project. I am able to to get (nearly) everything working. The builds are fine and the packages will be created on each build. But only when i do not specify a PublishProfile in the MSBuild Arguments. So it will only insert default values and not precompile my Web Sites and such. (Arguments are /p:DeployOnBuild=True /p:IsAutoBuild=True /p:VisualStudioVersion=12.0)

However I want to use the publish profiles (.pubxml) i created in Visual Studio. Each Project has a "Test.pubxml". But when i specify the PublishProfile parameter, the build will fail with the following error message (Arguments are /p:DeployOnBuild=True;PublishProfile=Test /p:IsAutoBuild=True /p:VisualStudioVersion=12.0):

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets (411): Can't find the valid AspnetCompilerPath

Yes, the file Microsoft.Web.Publishing.AspNetCompileMerge.targets does exist in that folder. I can deploy the projects from Visual Studio on my developer machine just fine.

I am using the following: Windows Server 2012 R2 Visual Studio Ultimate 2013 Update 1 (Installed on build server) Projects are for .Net 4.5.1

like image 604
wertzui Avatar asked Apr 28 '14 12:04

wertzui


Video Answer


1 Answers

I had the same problem, found this question, and came up with a slightly less hacky solution:

Just add /P:Framework40Dir=c:\windows\microsoft.net\framework\v4.0.30319 as an additional MSBuild parameter.

No need to edit .targets files or set anything else. Worked for me, so I just do:

msbuild MyWebProject.csproj /T:Package /P:PublishProfile=MyProfile /P:Framework40Dir=(as above)

I use it to build a Web Deploy package into a subfolder of my choosing - without the profile, it goes to obj/debug/package. Who uses obj? Blergh :)

like image 92
Kieren Johnstone Avatar answered Oct 04 '22 20:10

Kieren Johnstone