How to unshelve another developer's changes that include dlls or other binaries? - dll

Using Team Foundation Server 2010 I am trying to unshelve a series of changes made by another developer on my team. This shelve set includes some Nuget packages which include dlls. I am receiving multiple errors along the lines of:
The item $/file/path/some.dll is locked for check-out by USER in workspace MACHINENAME.
In 2008 Mac Noland asserted in his blog post Unshelving files that have File Merging disabled that this error is caused by having file merging being disabled. Which makes good sense to have file merges disabled for binaries. Based on the error I am assuming that TFS 2010 is still utilizing the merge utility when unshelving (makes sense as to why). That said I do not want to enable file merging for dll files.
Unfortunately, understanding what is going on and fixing it are two different things. In TFS is there a way to unshelve binary files which were shelved by a different user?

If the user created the shelveset, but left everything checked out locally, you will receive this error. Since TFS usually allows only a single checkout for binary files, a shelveset can't be unshelved if it contains a binary file which is locked by another user.
You can attempt to unlock the file with the following command -
tf lock itemspec /lock:none /workspace:OtherUsersWorkspace
You should be able to determine the workspace from the error message, and you'll also need to specify the user - /workspace:WORKSPACE;userid

In my case my source code is located at below location in my work station
D:\TFS\Source\Development\Cars.
I opened Visual Studio Command Prompt under Visual Studio Tools and ran it as Administrator.
I changed my command prompt to move to
D:\TFS\Source\Development\Cars
Executed below line
D:\TFS\Source\Development\Cars> tf lock HE/* /lock:none /workspace:zigglerworkspace /login:ziggler /collection:ziggler1pxtfs01\WebProjects
zigglerworkspace - my workspace name
ziggler - my user name
ziggler1pxtfs01\WebProjects - TFS server url
This released locks on all files and folders under HE folder which is located at
D:\TFS\Source\Development\Cars\HE

Install Microsoft Team Foundation Server 2010 Power Tools
Add C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools to your system path
cd c:[some location]\"destination workspace"
tfpt unshelve /migrate "shelveset name";otherUserName /source:"$/ProjectName/Main/Source" /target:"$/ProjectName/Main/Target"

Related

How to repoint TeamCity to a different MsBuild

I am unfortunately stuck on TeamCity 9 but want to use C# 7 language features. This requires me to have the VS2017 tools available, but in TC 9 you can only select up to 2015. I have manually installed the VS2017 toolkit on the build server and it is all available in
C:\Program Files (x86)\MSBuild\15.0
However in TC, the highest VS you can select to build with is 2015, which points to
C:\Program Files (x86)\MSBuild\14.0
I want some way to override this so that by selecting VS2015 in TeamCity, it will actually be pointing to MsBuild in
C:\Program Files (x86)\MSBuild\15.0
Is this possible?
Check you agent properties in TeamCity web interface. Search for your path: C:\Program Files (x86)\MSBuild\14.0 and write somewhere all keys that have this path in it.
Then go to your agent installation directory and edit file: C:\Path\To\BuildAgent\conf\buildAgent.properties
Add all those keys with new path, something like (assuming you key is MSBuildTools14.0_x86_Path):
MSBuildTools14.0_x86_Path=C:\\Program Files (x86)\\MSBuild\\15.0
(keep in mind escaping slash \\)
Restart your agent, and check again build agent properties. All paths should be replaced and you should be good to go.
This answer is based on comments from this issue: https://youtrack.jetbrains.com/issue/TW-54222

Which process generates final binary in Debug / Release folders?

I get the following error:
Error: Unable to copy file "obj\Debug\xx.exe" to "bin\Debug\xx.exe". The process cannot access the file 'bin\Debug\xx.exe' because it is being used by another process.
I'm using version 15.3.5 of VS.
I'm aware that csc.exe is the compiler. What I want to ensure, when debugging from Visual studio 2017, is which process is it that ultimately creates the final file in the bin or release folder? Is this constructed in the obj folder and copied over to the final destination by another process?
I suspect that this is our corporate antivirus, given that 'system' acquires the lock for a few minutes at a time.
What is the process name that ultimately creates the binary in the bin/debug or bin/release folder from Visual Studio?
I will use this to configure our antivirus exclusion list.
What is the process name that ultimately creates the binary in the bin/debug or bin/release folder from Visual Studio?
According the log in the output window "Copying file from "obj\Debug\xx.exe" to "bin\Debug\xx.exe", we could to know that the binary in the debug/release is copy from obj folder.
After using process monitor to monitor which process write file during build time, I found that the processes "VBCSCompiler.exe"and "devenv.exe" would write file for that .exe file. You can use process monitor to find out which process copy the .exe file. Besides, you can try to disable antivirus to verify whether antivirus causes this problem.
As a workaround, you can add Visual studio 2017 folder to antivirus exclusion list.

Can Orchard 1.8.x be installed on a build server that does not have Visual Studio Installed?

I also asked this question on the Orchard forum but no joy there yet. So here it is again...
https://orchard.codeplex.com/discussions/569444 Please read for a few more details.
IF the .NET 4/4.5 SDK came with a developer command prompt (like previous SDKs) then I would not be asking this question.
But since Orchard is build with .NET 4.5 I am getting build errors using the old SDK. It seems that my only option is to install Visual Studio Express on the build server.
I am doing that as we speak so at this point the question is purely academic but I am still curious.
EDIT
STILL NO JOY. Even after installing VS 2013 Express Web the vcvarsall.bat that usually configure the build environment is still not present. So this is no longer a curiosity question. The Express edition also cannot create my build environment. Help.
Seth
Here is my answer...copied and pasted from the forum.
This is a late answer. Bottom line is that I did eventually get our build server to build orchard projects. I am not sure if this is a complete answer or not as I should have answered as soon as I had it done. But I pretty sure this will work.
One other thing to note...It is quite possible that not all of these steps are required. I tried a lot of different things and it might be in the end some of the steps were not needed. It might also reflect a problem on our build server...especially the fact that I had to manually add registry entries.
But here it is without details.
Install the .NET Framework SDK for Windows 7.1.
http://www.microsoft.com/en-us/download/details.aspx?id=8279
Install the .NET 4.5 Full
http://www.microsoft.com/en-us/download/details.aspx?id=30653
Install Visual Studio 2013 Express for Web
http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx
Install the Visual Studio 2013 Build Tools
http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx
Finally, even after that...it didn't work until I added the following registry keys. I would attach the .reg file but I don't see how.
Save the lines between the lines into a fixBuild.reg file. Then double click...
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7]
"FrameworkDir32"="C:\Windows\Microsoft.NET\Framework\"
"FrameworkDir64"="C:\Windows\Microsoft.NET\Framework64"
"11.0"="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\"
"FrameworkVer32"="v4.0.30319"
"FrameworkVer64"="v4.0.30319"
"12.0"="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\"
Finally, to actually do the build, I created a batch file that does the build.
Save the lines between the lines into a doBuild.cmd file. Be sure to place this in the root of the source download...then double click to build...
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat"
msbuild /t:FastBuild Orchard.proj
The first line gets your environment ready. The second build the project using the FastBuild target in the Orchard.proj file. You can read that file if you want to try other build targets.
******* EDIT
There is one thing I forgot to mention. And that is that one thing you have to do to get this to work is that you have to edit some CSPROJ files because the command line build fails with errors like these...
\Orchard\src\Orchard.Web\Modules\CKEditor\CKEditor.csproj(337,6): error : "None" element name for include "Placement.info" should be "Content".
\Orchard\src\Orchard.Web\Modules\Orchard.Tokens\Tests\Orchard.Tokens.Tests.csproj(82,6): error : "None" element name for include "app.config" sh
\Orchard\src\Orchard.Web\Modules\TinyMceDeluxe\TinyMceDeluxe.csproj(377,6): error : "None" element name for include "app.config" should be "Cont
\Orchard\src\Orchard.Web\Modules\Upgrade\Upgrade.csproj(156,6): error : "None" element name for include "app.config" should be "Content". [C:\Us
\Orchard\src\Orchard.Web\Themes\Themes.csproj(280,6): error : "None" element name for include "Upward\Views\Content-Story.Detail.cshtml" should
The fix is to do exactly what the error indicates. Open the csproj files and search/replace "
Also, some of the projects reference app.config files that do not exist in source. You also have to remove those references. I usually just delete the content node entirely or the group entirely.
Seth

How to avoid having (or delete) PDB files in TFS 2012 build result

When using DefaultTemplate from Visual Sturdio 2012 (and TFS 2012 server), the PDB files are included in build directory. I do not want them.
Is there a way not to generate those files during build process?
Or
How can I delete those files?
I found this thread about deletion but seems a bit strange (no delete activity?)
There also is this answer but does not involve XAML template.
Thanks in advance for your help.
PDB files hold debug information on your code and its not advised to disable them, they are valid output hence deployment shouldn't be messing with them.
You can disable their generation in Visual Studio project Properties> Build > Advanced > Debug Info = none.
If you absolutely want them gone then disable them for build specific configuration (relaese etc.)
The build server by default does whatever the Solution (sln) tells it to. That by default is to do a "Debug" build and that created the PDB's. You can tell the Build to do a "Release" build that will not by default create any PDB's...
Figure: Adding a Build Configuration
I would however recommend against it as the PDB's contain information that you need even in production systems. Consider for a moment that you have a DLL in production and the customer is encountering a problem. You get them to create an InteliTrace log so that you can debug it locally (or they let you debug on their environment) and suddenly you are trying to debug without Visual Studio understanding the relationship between the Executable and the Source Code. So no debug...
Since I was unable to find building option to disable PDB file generation, I delete them afterwards.
There is no easy way to delete files. I did:
use a FindMatchingFiles Activity with wildcard *.pdb, which returns
a full path to pdb files
use a Foreach loop
call a DotNet method in the loop for each file with the InvokeMethod Activity,
with target type System.IO.File and method being "Delete"
In the previous version (Visual Studio 2010)
When we build /release, it was not generating PDBs, the PDB files are created when we only build with /debug:full or /debug:pdbonly, we use /debug:pdbonly if we want to generate PDBs for a release build that we do not want to be debuggable.
This is not the case in Visual Studio 2012, I checked it and I found it generated PDBs in both, /debug and /release
There is no documentation for Visuals Studio 2012.

TFS 2010 Build Publish via file system

I've got a fairly large MVC2 project in TFS which gets built automatically on checkin (Continuous Integration)
At present, the fully built version is dumped on a network share on our dev IIS server. \\Server\wwwrootLatest
TFS of course creates lots of sub-folders since it's just doing a build, it isn't even aware that it's drop directory is a wwwroot.
This means that to actually USE the build, we need to go and manually create an IIS App which points at the appropriate directory - which defeats the whole object of the exercise.
When we do a manual publish to that server, we use "File System" as the method and just overwrite the files in the UNC share \\Server\wwwroot
(When publishing to other environments, we use full-on MSDeploy.)
What I'd like to do is convince TFS to do a "File system" publish after the build completes and duplicate what we do on a manual publish eg:
Drop directory is \\Server\Build which would result in something like \\Server\Build\Project\Date.Rev\
After that is complete, we want it to publish to \\Server\wwwrootLatest - we can then set up the App once which will always contain the latest version but will still have a full history if required.
The only examples I've been able to find use MSBuild commands in the build definition (fine) but all use MSDeploy to do a full-on publish. I'm not sure how to automate what I want to do
Any help appreciated.
In your drop folder a folder named _PublishedWebsites is generated automatically. It contains files you need to put in wwwroot. You can use CopyDirectory build activity to copy them automatically.