TFS2010: Build Configuration Issues - visual-studio-2010

I have customized the build configurations in my solution by deleting the Debug and Release configurations and creating "Dev" and "Test". Everything builds fine locally but I get the following error (and others like it) when building one of the new configurations in TFS.
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets
(177): Unable to copy file
"bin\CommonServiceFactory.dll" to
"C:\MyApp\Binaries_PublishedWebsites\Epsi.Web\bin\CommonServiceFactory.dll".
Could not find a part of the path
'bin\CommonServiceFactory.dll'.
I'm getting this error for both external and project dependencies. From the posts I've read it seems to be related to the build configuration changes I've made. If I set the TFS build to use the "Debug" configuration I do get a warning but it builds successfully.
C:\MyApp\Sources\MyApp.sln.metaproj:
The specified solution configuration
"Debug|Any CPU" is invalid. Please
specify a valid solution configuration
using the Configuration and Platform
properties (e.g. MSBuild.exe
Solution.sln /p:Configuration=Debug
/p:Platform="Any CPU") or leave those
properties blank to use the default
solution configuration.
Any help would be most appreciated.
MSBuild Command:
MSBuild.exe /nologo /noconsolelogger "C:\Builds\2\MyApp\ci.MyApp.acme.com\Sources\MyApp.sln" /m:1 /fl /flp:"logfile=C:\Builds\2\MyApp\ci.MyApp.acme.com\Sources\MyApp.log;encoding=Unicode;verbosity=diagnostic" /p:SkipInvalidConfigurations=true /p:OutDir="C:\Builds\2\MyApp\ci.MyApp.acme.com\Binaries\" /p:Configuration="Dev" /p:Platform="Any CPU" /p:VCBuildOverride="C:\Builds\2\MyApp\ci.MyApp.acme.com\Sources\MyApp.sln.Any CPU.Dev.vsprops" /dl:WorkflowCentralLogger,"C:\Program Files\Microsoft Team Foundation Server 2010\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Diagnostic;BuildUri=vstfs:///Build/Build/2603;InformationNodeId=449514;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;TFSUrl=http://tfsServer01:8080/tfs/Core%20Development;"*WorkflowForwardingLogger,"C:\Program Files\Microsoft Team Foundation Server 2010\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Diagnostic;

The error message indicates that you do not have the dll in the bin\ directory. If you can get on the build machine, can you check to see where the assemblies of your projects were built to? Make sure the path to the assemblies is the one used by the copying/publishing task to copy the assemblies to the Binaries_PublishedWebistes folder.
If this doesn't help, can you post the msbuild command-line from the TFS build details log up?

Related

Build specific Visual studio project under project solution using Msbuild and devenv

I have Visual studio project solution which has multiple .csproj. Each .csproj has some reference libraries.The project settings are made in such a way the reference libraries are built first and then .csproj is built. This works as expected when i run it in visual studio IDE. But when i try to execute using msbuild i'm getting an error saying target doesn't exist. Gone through many posts related to this issue ,tried possible things.But didn't built.Looks like i might be doing something silly or missing something in the settings.
Also tried using devenv from commandline. With this option i dont see any error but at same time the project doesnt build.I dont see any message after execution of command.Im using visual studio 2015
Here is my project structure
Poject.sln
ProjectA
porjectB
projectC
Libraries
libA
libB
msbuild "project.sln" target:"D:\Projects\Source\Demo\ProjectA\ProjectA.csproj" /t:build
"/p:Configuration=Debug" "/p:platform=x86"
I see the below error
"D:\project.sln" (D:\Projects\Source\Demo\ProjectA\;build target) (1) ->
D:\project.sln.metaproj : error MSB4057: The target "D:\Projects\Source\Demo\ProjectA" does not exist in the project. [D:\project.sln]
Here is the command used using devenv
devenv.exe "project.sln" /build Debug /project `"D:\Projects\source\Demo\Applications\ProjectA\ProjectA.csproj" /projectconfig Debug
After executing the above its doesnt build and i dont see any error too.
error MSB4057: The target "D:\Projects\Source\Demo\ProjectA" does not
exist in the project.
The error indicates your path in command is not valid and project.sln can't recognize the path. So you actually meet one path-related issue. And you should pass the ProjectA to the targets argument instead of ProjectA.csproj! More details see tip3 in For MSBuild.
For MSBuild:
1.If you're only trying to build ProjectA and its reference libraries.
Navigate(cd) to path where ProjectA.csproj exists, and then use command msbuild ProjectA.csproj /t:build /p:Configuration=Debug /p:platform=x86
Also you can directly use command msbuild AbsolutePath\ProjectA.csproj /t:build /p:Configuration=Debug /p:platform=x86. It's not necessary to use " to cover the path and arguments.
(ProjectA.csproj file should have definitions about the reference to those two library projects, so msbuild ProjectA.csproj will build those two projects first. You don't need to specify the xx.sln in your command.)
2.If you're trying to build whole solution(all the projects):
msbuild project.sln /t:build /p:Configuration=xxx /p:platform=xxx
Navigate to solution folder when you run above command, or use absolutepath\project.sln with that command.
3.When you want to build specific projects(more than one) in solution:
Check How to: Build Specific Targets in Solutions By Using MSBuild.exe. Since you're only build ProjectA, you don't need to use this format. For example: Only when you need to build both ProjectA and ProjectB, but not build ProjectC... You can use command like:
msbuild xxx.sln /t:NotInSlnfolder:Build;NewFolder\InSolutionFolder:Build
Pay attention to the path when you use this format. Whether your project is in solution folder can affect the build result a lot ! And, the direct cause of your issue, this command's targets argument needs one ProjectName as input instead of ProjectName.csproj.
For Devenv command:
1.I always use VS2017 and VS2019,so I'm not certainly sure if VS2015's devenv related command has big difference from VS2017's or VS2019's. But according to details from this VS2017 document:
Commands that begin with devenv are handled by the devenv.com utility, which delivers output through standard system streams, such as stdout and stderr.
Alternatively, commands that begin with devenv.exe can use the same switches, but the devenv.com utility is bypassed. Using devenv.exe directly prevents output from appearing on the console.
I think that's why you don't see any message after execution of command. You should use devenv.com command to see the output in console. And it's by design that devenv.exe will prevents output from appearing on the console.
2.The following command builds the project CSharpWinApp, using the Debug project build configuration within MySolution.
devenv "%USERPROFILE%\source\repos\MySolution.sln" /build Debug /project "CSharpWinApp\CSharpWinApp.csproj" /projectconfig Debug
More details about devenv reference please check this document.
In addition:
1.Looks like you have one strange project structure. I checked your error message above and it seems your several projects(xx.csproj) are not under Solution(xx.sln) folder. Just a suggestion, the normal folder structure for VS2015 is always:
Solution folder
xx.sln
ProjectA folder
ProjectA.csproj
ProjectB folder
ProjectB.csproj
2.For most of the projects, build using msbuild is more powerful and convenient than build using devenv. So if you don't have special reason, I recommend using Msbuild, the build engine of VS.
Hope all above helps to resolve your issue and puzzle. Let me know if your issue persists:)
File "/Users/morel893/Desktop/env/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "projects_project" does not exist
LINE 1: ...ct"."technology", "projects_project"."image" FROM "projects_...

TFS 2015 Visual Studio Build - Package .zip not being created

I'm trying to build my solution and package up the web app into a web deploy (.zip) package to be deployed.
I've added the Visual Studio Build step with the following MSBuild Arguments:
/p:DeployOnBuild=True /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)\"
And I've set up the Copy and Publish Build Artifacts step to copy all .zip files to the drop folder.
The build completes successfully but nothing is copied to the drop folder because there are no .zip packages that get created.
So when I look on the TFS server, the only thing in the 'a' folder is an empty 'drop' folder. And in the 's' folder is the solution directory with a PrecompiledWeb folder in it. Not sure what that is but it doesn't look like the deployment package (and it's not a .zip).
Any ideas?
I have tried the same on VS2015 MVC web application using VSTS and TFS 2015.2.1 both. I had to do a slight change to the Build arguments in Visual Studio build. That is removing the trailing "\" in /p:PackageLocation="$(build.artifactstagingdirectory)\".
Here is the argument I passed to Visual studio build step
/p:DeployOnBuild=True /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)"
Then I used Copy and Published Build Artifacts (Deprecated in VSTS you should use Copy task and Publish task instead of this task) as shown below
This gives me output as below.
First suggest you manually remote in the build agent and build the project through MSBuild command line with arguments to see if the project builds properly.
This will narrow down the issue is related to the environment on your build agent or your build definition.
You should directly use /p:PackageLocation=$(build.stagingDirectory
Besides since you have multiple assemblies that are referenced in the web app. Please also double check dependencies that are building in the correct order or referenced correctly.
Make sure the ASP.NET development workload of Visual Studio is installed.
If DeployOnBuild is having no effect, you may need to install the ASP.NET Development "workload" with the VS setup tool.
There are specific .targets files that, if they don't exist, cause these parameters to be silently ignored. Installing this adds those .targets and the parameters become active, allowing the .zip to be created.
For me (VS 2017) the relevant target file (or one of them, anyway) that was missing but is needed is:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.targets
If it is missing, you'll need to install as above, and if it is there, then you have a different problem. ;)

MSBuild 2015 fails packaging web app from VS2010

I have a build server that until recently had up to .Net 4.5.1 and VS2010/VS2012 installed. I ran MSBuild to build and package web apps as follows:
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" Hartford.Pace.sln /nologo /v:n /p:Configuration=Release /p:DeployOnBuild=True /p:CreatePackageOnPublish=True /p:AutoParameterizationWebConfigConnectionStrings=False /p:EnableNuGetPackageRestore=True
I recently updated the build server to include Frameworks through 4.6.1 and VS2013/VS2015. Everything was installed in sequence. I updated the build command to:
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" Hartford.Pace.sln /nologo /v:n /p:Configuration=Release /p:DeployOnBuild=True /p:CreatePackageOnPublish=True /p:AutoParameterizationWebConfigConnectionStrings=False /p:EnableNuGetPackageRestore=True /p:VisualStudioVersion=10.0
And now I'm getting the following error only for VS2010 web apps:
"d:\a5\bi_hartsource_pace\Microsoft_Build_Web_App\trunk\Hartford.Pace.sln" (default target) (1) ->
"d:\a5\bi_hartsource_pace\Microsoft_Build_Web_App\trunk\Hartford.Pace.Services\Hartford.Pace.Services.csproj" (default target) (2) ->
(PackageUsingManifest target) ->
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009,5): error : Web deployment task failed. (Unknown ProviderOption:DefiningProjectFullPath. Known ProviderOptions are:.) [d:\a5\bi_hartsource_pace\Microsoft_Build_Web_App\trunk\Hartford.Pace.Services\Hartford.Pace.Services.csproj]
Which points to a problem with the packaging target files. I checked them and none of them were changed by the update.
Does anyone know of side-by-side issues with VS2010 and VS2015? I'd like to upgrade the VS2010 Solutions but it's not my code and I need to build existing apps without modification.
Is this the best method for packaging an app without having the developers create publishing profiles or running anything at their end? This is supposed to be a fully automated build and deploy process. It has been working for three years with no issues but I'm open to suggestions that I can implement entirely on my build server without involving changing files in the source code (including csproj or other controlling files).
Add /p:VisualStudioVersion=10.0

Visual Studio Online - "The specified solution configuration "Debug|any cpu" is invalid"

I need to build VS solution under Visual Studio Online. But when I run it, I get an error:
C:\a\50009cdf\Mobius-ASG\Prototyping\VCPROJ\SystemAl.sln.metaproj(0,0): Error MSB4126: The specified solution configuration "Debug|any cpu" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.
I've tried to change 'BuildPlatform' to 'Mixed Platforms' and 'BuildConfiguration' to 'Release'. But it didn't help, I got same error but with new values:
The specified solution configuration "Release|Mixed Platforms" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration
Also I've tried to disable and delete this variables, but still have the same error.
Haw can I fix it?
To set the configuration and platform of the project, please right-click the project in the Solution Explorer and select Configuration Manager.
In the Configuration Manager dialog, choose the configuration and platform value you want. Check in the pending changes into VSO, and re-run the build without any argument. You should now get the build run successfully.

Publish doesn't work from build definition VS2012

What I thought would be simple is not. All I am trying to do is get MSBuild to copy website files to another server after my build.
In my Build definition Under Process --> Advance --> MSBuild Arguments I put
/p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile
It builds fine but it never copies files to destination
BUT when I run this command locally, IT WORKS!!!!!
msbuild /p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile
I have VS 2012 installed in Build Server so I think all the necessary files are there.
What is the problem?
UPDATE 1
Output in build log file
Run MSBuild for Project
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /nologo /noconsolelogger "C:\Builds\1\MyProject\MyProject\src\MyProject.sln" /nr:False /fl /flp:"logfile=C:\Builds\1\MyProject\MyProject\src\MyProject.log;encoding=Unicode;verbosity=detailed" /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile /p:VisualStudioVersion=11.0 /m /p:OutDir="C:\Builds\1\MyProject\MyProject\bin\\" /p:RunCodeAnalysis="False" /p:VCBuildOverride="C:\Builds\1\MyProject\MyProject\src\MyProject.sln.vsprops" /dl:WorkflowCentralLogger,"E:\Microsoft Team Foundation Server 11.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Detailed;BuildUri=vstfs:///Build/Build/64;InformationNodeId=20178;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;TFSUrl=http://abc-tfs-p:8080/tfs/defaultcollection;"*WorkflowForwardingLogger,"E:\Microsoft Team Foundation Server 11.0\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Detailed;"
REPRODUCTION STEPS
Created new website project
Made sure it worked on local machine
using development server
Checked code in TFS
Created a build definition using all the default settings Under the Process -->
Advance --> MSBuild Arguments I put
/p:DeployOnBuild=true /p:PublishProfile=WebsiteProfile
The publish profile copies the changeset to a remote server.
Installing the Web Tools 2012.2 update on the build server fixed this issue for me after I read this post and Scott Gu's Blog. I don't have Visual Studio installed on the server but installing the update got my DeployOnBuild working. I hope that helps.

Resources