ASP.NET Website Project auto deploy with TFS 2013 build

1.6k views Asked by At

I have a ASP.NET Webforms Website project(note this is NOT WebApplication project i.e. there is no .csproj).

I want to do a auto deploy, file system to our network share.

I created a profile and so there is website.publishproj file and profile xml.

I tried adding this in MSBuild arguments in Build Definition:

website.publishproj /p:DeployOnBuild=true /p:PublishProfile=MyDevProfile /p:VisualStudioVersion=12.0

I get this error:

MSBUILD : error MSB1008: Only one project can be specified. Switch: website.publishproj

Any idea what am I doing wrong? I believe this has something to do with Website project type.

This is something I read: How to use command line msbuild to deploy VS2012 Web Site project without precompiling it?

Here is the command:

C:\Program Files (x86)\MSBuild\12.0\bin\amd64\MSBuild.exe /nologo /noconsolelogger "E:\Builds\1\TP1\MyWebsite_Dev\src\Websites\MyWebsite\MyWebsite.sln" /nr:False /fl /flp:"logfile=E:\Builds\1\TP1\MyWebsite_Dev\src\Websites\MyWebsite\MyWebsite.log;encoding=Unicode;verbosity=normal" /p:SkipInvalidConfigurations=true website.publishproj /p:DeployOnBuild=true /p:PublishProfile=DropToDemoProfile /p:VisualStudioVersion=12.0 /m /p:OutDir="E:\Builds\1\TP1\MyWebsite_Dev\bin\" /p:VCBuildOverride="E:\Builds\1\TP1\MyWebsite_Dev\src\Websites\MyWebsite\MyWebsite.sln.vsprops" /dl:WorkflowCentralLogger,"C:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;BuildUri=vstfs:///Build/Build/35;IgnoreDuplicateProjects=False;InformationNodeId=13;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;LogWarnings=True;TFSUrl=http://mytfs:8080/tfs/colletionname;"*WorkflowForwardingLogger,"C:\Program Files\Microsoft Team Foundation Server 12.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Normal;" /p:BuildId="7d23530d-7349-406f-98b7-5d4f0b9f4101,vstfs:///Build/Build/35" /p:BuildLabel="MyWebsite_Dev_20141122.13" /p:BuildTimestamp="Sun, 23 Nov 2014 01:22:05 GMT" /p:BuildSourceVersion="LMyWebsite_Dev_20141122.13@$/TP1" /p:BuildDefinition="MyWebsite_Dev"

2

There are 2 answers

7
Ilya Kozhevnikov On BEST ANSWER

You're trying to build the solution (MyWebsite.sln) and the project (website.publishproj) simultaneously as part of the same MSBuild command at least according to the arguments being passed.

You can run msbuild website.publishproj /pp:website.pp.publishproj to see what targets you can call in website.pp.publishproj or what properties to override.

You can run set MSBUILDEMITSOLUTION=true && msbuild MyWebsite.sln to see what targets you can call in MyWebsite.sln.metaproj and MyWebsite.metaproj or what properties to override.

Your DeployOnBuild command is fine and should work, I'm guessing your TFS build config is pointing to the .sln and passing website.publishproj as an argument rather than the primary target of the build, so either repoint it to build the .publishproj directly or... well, there doesn't seem to be any alternative, you can try adding a new configuration and editing the .sln with new AspNetConfiguration and MyDevProfile.AspNetCompiler.TargetPath but then you're just asking for trouble.

1
MrHinsh - Martin Hinshelwood On

You need to upgrade your Web Site to a Web Application in order for any of this to be automatic.

Its a fairly simple procedure and even on sites with thousands of pages I have completed the migration in only a few days of one persons time without impacting other devs.

Web Site functionality has been feature complete for over 10 years. While it still existing in the product for back-compat I would not recommend using it.