Unable to copy file exception in TFS build - visual-studio-2010

I am getting following error
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets (178): Unable to copy file "bin\AjaxControlToolkit.pdb" to "C:\Builds\2\testbox\test\Binaries\_PublishedWebsites\test\bin\AjaxControlToolkit.pdb". Could not find a part of the path 'bin\AjaxControlToolkit.pdb'.
Just checked file is available on path.
same working fine on local as well as while building from team city. Don't know whats going wrong.
Edited
Just cant understand why it is trying to copy from obj directory..Please see the following log
Copying file from "obj\Debug\Manager.dll" to "C:\Builds\2\box\Two\Binaries\Manager.dll".
Manager -> C:\Builds\2\box\Two\Binaries\Manager.dll
Copying file from "obj\Debug\Manager.pdb" to "C:\Builds\2\box\Two\Binaries\Manager.pdb".
Copying file from "obj\Debug\Manager.xml" to "C:\Builds\2\box\Two\Binaries\Manager.xml".
Done Building Project "C:\Builds\2\box\Two\Sources\Manager\Manager.vbproj" (default targets)
Where as I have set the output to bin.

Possible reasons:
This reference is dynamic, meaning its path gets cleared and created on each build. Third party reference files should be checked in the source control to a common shared folder (e.g. \lib).
Your project have a file reference to AjaxControlToolkit to a path
which does not exist on build the server. Open the project's .csproj
file,and check the HintPath of AjaxControlToolkit.
Avoid referencing third party assemblies from the GAC (where the first bullet is applicable).

Related

VSTS Copy and Publish Build Artifacts copying the whole project instead of the necessary files

I am trying to copy my build to a particular drop location. But instead of copying the some important files and directories it is copying all the solution file and directories there like .csproj files and .csfiles and also all the folders present there.
I only want to copy dlls(projects dlls and references dlls of the project) and some data Folders and files to drop location so that I can use them to execute my test cases. But it ends up copying the whole solution.
Below are the setting I am using to copy and publish build artifacts.
Can Anyone tell me how can it be done?
Note: when I tried to put $(build.sourcesdirectory)\bin in the copy root it gave me an error that "Cannot bind argument to parameter 'Path' because it is null".
I also tried putting only **.dll in my contents but then it copies nothing. The folder created in drop location comes empty.
You're telling it to publish **/*test*.dll, from the root of the build agent. That minmatch pattern is saying "find everything in every subfolder that matches test.dll", so the results you're getting aren't surprising.
What you probably want to do is specify the path to the binary output location of your test projects. Without seeing the structure of your code or what MSBuild variables you're providing/overriding, it's impossible to give more guidance. Look at the documentation on pre-defined variables and that should give you some ideas.
In general, you want to set your output folder (via MSBuild arguments) to $(Build.ArtifactStagingDirectory), so only build outputs go there. Then you can use that as your Copy Root.

A matching symbol file was not found (Cannot find/open pdb file)

The debug point is not getting enabled when this module gets loaded. So I thought of manually loading its debug symbols .pdb file from "Debug/obj" folder.
In this case I am getting below error "A matching symbol" file was not found in this folder though that folder contains currently build file.
And also the "Symbol Load Information" contains these many directory paths.
Cannot find or open the PDB file.
PDB does not match
Screenshot:
This problem is fixed by the following steps-
1) Close all the instances of VISUAL STUDIO if running and open a single instance of Visual Studio
2) Close the solution (nothing but your project) If it's already open and then re-open again
3) Clean the whole project and rebuild it.
4) and also build the project if you are getting any errors like "___.dll not found"
5) Now you are good to go and run your project
After breaking my head on this, for me it happened when I configured my project to seperate binaries from objects that way:
For Output directory:
$(SolutionDir)build\bin\$(PlatformTarget)-$(Configuration)\
For Intermediate Directory:
$(SolutionDir)build\obj\$(PlatformTarget)-$(Configuration)\$(ProjectName)\
Even though the I still had the generated .pdb where my exe or trying to even load it manually, it didn't work.
So I went again to Configuration Properties -> Linker -> Debugging and where the property Generate Program Database File I changed from $(OutDir)$(TargetName).pdb to $(IntDir)$(TargetName).pdb so it will throw the desired database file into the place where the objects(Intermediate Directory) are instead of where the .exe(Output directory). Hopefully that helped someone :)

web deployment package (.zip file) not created in Visual Studio 2013

I am trying to create a deployment package in Visual Studio 2013. I have specified that the package should be placed at C:\Deployment\bin\WebSite.zip - the absolutely simplest location. All the project files build but the publish fails with this error:
Transformed Web.config using C:\Services\IdentityServer\Thinktecture.IdentityServer.v2\src\OnPremise\WebSite\Web.Siloed.config into obj\Siloed\TransformWebConfig\transformed\Web.config.
Auto ConnectionString Transformed Areas\Admin\Views\Web.config into obj\Siloed\CSAutoParameterize\transformed\Areas\Admin\Views\Web.config.
Auto ConnectionString Transformed Views\Web.config into obj\Siloed\CSAutoParameterize\transformed\Views\Web.config.
Auto ConnectionString Transformed obj\Siloed\TransformWebConfig\transformed\Web.config into obj\Siloed\CSAutoParameterize\transformed\Web.config.
Copying all files to temporary location below for package/publish:
obj\Siloed\Package\PackageTmp.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(2584,5): Error : Copying file ..\..\..\Deployment\bin\um.zip to obj\Siloed\Package\PackageTmp\.ebextensions\um.zip failed. Could not find a part of the path '..\..\..\Deployment\bin\um.zip'.
I have no idea where this path '......\Deployment\bin\um.zip' is coming from. I specified that the deployment package should be created at C:\Deployment\bin\WebSite.zip, not um.zip.
So, I checked out C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(2584,5) and the code looks like this:
<!--Force Copy Of all file to the $(WPPAllFilesInSingleFolder) if needed-->
<CopyPipelineFiles PipelineItems="#(FilesForPackagingFromProject)"
SourceDirectory="$(WebPublishPipelineProjectDirectory)"
TargetDirectory="$(WPPAllFilesInSingleFolder)"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="True"
DeleteItemsMarkAsExcludeTrue ="True"
Condition="'#(FilesForPackagingFromProject)' != ''">
<Output TaskParameter="ResultPipelineItems" ItemName="_FilesForPackagingFromProjectTempory"/>
</CopyPipelineFile>
I have tried editing the "PipelineItems" and "SourceDirectory" and have even hardcoded them. But the same message, "Could not find part of the path....", is being displayed every time I run the Publishing. The "Could not find part of the path...." points to the new paths I specified in "PipelineItems" and "SourceDirectory. The .zip file never seems to get created anywhere. I have seached my entire computer for um.zip and WebSite.zip with not luck.
Any help would be greatly appreciated as I am completely out of ideas.
Turns out this um.zip is somehow part of build but it is not getting created. Anyway, I was lucky enough to find a previous deployment package that was generated and I just manually built the new deployment package based off the old one. Deployed fine so I guess that is how I will proceed.

Relative paths with MSBuild project vs solution

I have a number of projects which are joined into a solution. Every project has it's own directory structure, and csproj files are located on diferrent level of folder structure.
Every csproj has OutputPath property specified. OutputPath - is a relative path and it varies from project to project in such a way so all projects have the same output dir.
It is work OK if I build a separate project. But everything changes if I try to build solution file. In this case every project output folder differs (depends on a number of '..\' in that project's OutputPath).
I do know, that before some moment all was working fine. Nobody changed build.cmd neither any sln or csproj files. But now I have situation described above.
So my question is - what affects how relative path is evaluated? I mean how can I force relative OutputPath to be evaluated starting from folder where csproj file of that particular project is located. Not from folder where .sln file is.
Let's assume I have following directory structure:
dir1
a.sln
dir2
a.csproj
dir21
dir3
b.csproj
a.csproj has output path set to '../../_bin' which is just above dir1 if counted from a.csproj folder
b.csproj has output path set to '../../../_bin' which is same - just about dir1 if counted from b.csproj
a.sln contains both - a.csproj and b.csproj.
When I run msbuild I get a project build to 'dir1/../../_bin' and b project to 'dir1/../../../_bin' - both relative paths of projects files are counted from solution file location, not project files.
Well, I was able to find out what was causing this. That was custom .targets file, which was inferring SolutionDir property at the start of any msbuild.
I did find out that by using MSBuild Explorer. The tool proved to be very useful in my case - I was not aware of third party .target files on my system.
From Msbuild Import Element description
Relative paths in imported projects are interpreted relative to the
directory of the importing project. Therefore, if a project file is
imported into several project files in different locations, the
relative paths in the imported project file will be interpreted
differently for each imported project.
All MSBuild reserved properties that relate to the project file, for example, MSBuildProjectDirectory
and MSBuildProjectFile, that are referenced in an imported project are
assigned values based on the importing project file.
If you add more details or few samples to your question - it will be easier to understand exact problem.
Edit:
Okay, lets try to pinpoint that mystery. First of all - OutputPath could be affected by Environment variables.
2nd - during build sln file transformed into msbuild project file format and stored in temp file. You can get that temporary file if you execute in cmd "set msbuildemitsolution=1" and then trigger build via command line. There you can check that file and see how your individual projects called. But I suppose you will see multiple .csproj /> entries. And global msbuild properties inherited by that calls.
So I suspect if everything was fine before some point and no changes were made - you are missing OutputPath environment variable or some other variable that contributed to construction of OutputPath.
BTW - I think if you want to fix your issue with forcing relative dir - you also can use $(MSBuildProjectDirectory). This is one of msbuild reserved properties (from here), but this will require yo adjust your OutputPath in each csproj file. What i, personally, prefer to avoid, because it could affect some other targets and introduce subtle issues.

When trying add existing project to solution, a project in a different path is referenced

I am doing some housecleaning with our VC++ project structure and I had the following weird directory setup. In one folder, called "USBAScan", I have a Visual C++ project file, named "USBAScan.vcxproj". USBAScan has a subfolder that is also called "USBAScan". It also has a VC++ project file named "USBAScan.vcxproj".
My VC++ solution references a project named "USBAScan.vcxproj". Its project file property is "USBAScan\USBAScan\USBAScan.vcxproj". I remove this project and delete the project file USBAScan\USBAScan\USBAScan.vcxproj. In the solution I try to add USBAScan\USBAScan.vcxproj. I get the following error message:
"The project file USBAScan\USBAScan\USBAScan.vcxproj has been moved, renamed or is not on your computer".
Although I'm trying to add USBAScan\USBAScan.vcxproj, the solution is trying to add USBAScan\USBAScan\USBAScan.vcxproj. Why would it behave this way?

Resources