Visual Studio/TFS 2012 - Retrieve original filepath from .tmp files in comparison - visual-studio

I'm working on developing a specific comparison tool in Visual Studio 2012 with TFS 2012 installed, and am having trouble getting around TFS's use of temporary files for comparison. In Tools > Options > Source Control > Visual Studio TFS > Configure User Tools..., shown here:
I'm modifying the command for comparing .xml files, and TFS gives me the following options to add as command lines parameters to Powershell:
The issue is, I'm calling a custom Powershell script that will do some processing and determine what action to take based on the files that are being compared. However, some of the information required to process is the actual source control filepath of each file; which would appear to be stored in command line args %1 and %2. Unfortunately, TFS uses .tmp files to actually perform comparisons, so each of those paths points to the .tmp (stored in local AppData) file instead of the original .xml filepath that I need.
The contents of the files do not have the information I'm looking for, and the filepath is guaranteed to. Is there any way at all to use any other of the command line arguments provided by TFS to pass through the original filepaths to Powershell, or can I somehow tie back the .tmp files to the .xml path? I'm kinda stuck at this point. Thanks!

There is no option to specify the file in the argument. I've tested on my side with TFS2015 + VS2015, when added the PS tool to compare .xml file, it did compare .xml files, not .tmp file.
You can also specify the Source Path and Target Path when you compare the .xml files:

Related

Making single executable includes all program file and folders with nsis?

I have zip file containing my installation files. I'm extracting this zip and copying these files into installation directory with the script shown below:
ZipDLL::extractall "$OUTDIR\demo.zip" "C:\myapp\demo\"
if I remove zip file from $OUTDIR than installer is not able to find zip file as expected. What I want to do is embedding this zip or its extracted folders into exe itself. I added
File -r "$OUTDIR/demo"
but this script didn't worked as well.
When you use the ZipDll plugin, you are referring to the file you want to process (demo.zip) by using its place at run time: along the installer.exe.
When you use the File statement to embed some files into the produced installer, you need to refer to the files by using their place at compile time.
Replace the $OUTDIR in the File statement by the path relative to the .nsi script.
BTW, you should take the habit to check at the compilation log, NSIS probably tells you about that kind of problem when paths are incorrect at compile-time.

List of today's updated files in VSS

I am using this command and this does nothing, not even an error message, I am confused where does the result go and where can I check it?
C:\Program Files\Microsoft Visual SourceSafe> ss.exe history $/myproject -Vd24/10/13~23/10/13 -R
I have also set the environment variable i.e. set ssdir which is working fine.
I have to get the list of files (just file names) which are checkedin (modified) today.
I have to get the list of files (just file names) which are checkedin
(modified) today.
You can Right-click on the directory in VSS Explorer and choose View History: you can add date filters to the search

How do I make sure every file in an included directory is copied to the destination in Visual Studio?

I'm building an application that has quite a few files that need to be included in the destination directory. So far, there haven't been very many files so I would simply change the settings of each file individually to Copy to Output Directory :: Copy if newer. The problem now is that I'm adding files at an exponential rate.
Do any of you know how to make all of the files that are sub of the "Some_Directory" have the Copy to Output Directory :: Copy if newer set how I want it?
You cam use a post-build event.
Using following posts, I made a post event that does exactly what you want:
Copying files into the application folder at compile time
Copy to Output Directory copies folder structure but only want to copy files
Visual Studio adds .dll and .pdb to project after compiling
Now, you can easily edit Post-build events, go to your project settings and go to the Compile tab, now click the Build Events and put following line in the *Post-build event command line" text box:
xcopy "$(ProjectDir)Test\*.*" "$(TargetDir)Test\\" /E /I /F /Y
See this image:
In your case you will have to change "Test" by "some_directory" and that's all.
There is one caveat, however. This copies every file every time my project builds. The folder that is being copied is over 3MB (I'm developing quite a large project). This makes debugging take quite a long time because every time I do a build it has to move all of the content over. Is there a way to make it only copy over files that have been updated since the last build? This is why I was using the Copy if newer option.
You can add the /D parameter (you can look that up with xcopy /? in your command prompt).
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
You can write your own custom Post-Build event (Select project -> Properties -> Build Events) with xcopy command. You can use $(solution) macro for your solution directory and specify relative path to your files.
I had the same issue, but the accepted answer didn't solve it. What worked for me was to enable deployment in Local.testsettings (under Solution Items).

Finding all the visual studio projects a file belongs to

I'm working on a visual studio solution with over 30 projects and multiple filters.
What is the easiest way to determine all the projects a file belongs too?
First, open a command shell window and create a list of all project files in a text file. For example, for C# projects (having the ending .csproj), run this command in the root folder of your solution:
dir /s /b *.csproj >projectlist.txt
Then, you can easily determine all projects containing a specific file by the command
findstr /f:projectlist.txt /m Name_Of_Your_File
Just a suggestion: you can avoid much trouble for the future if you make sure each project has it's own folder, and all files belonging to that project are in or below that folder.
Use AgentRansack or similar tool that allows searching text contained in a file.
Use the following settings:
File Name: *.csproj
Containing Text: YourCodeFile.cs
Look in: YourSolutionFolder
Run the search and you will get a list of all project files that are holders of the CS file.

How to force the build to be out of date, when a text file is modified?

The Scenario
My project has a post-build phase set up to run a batch file, which reads a text file "version.txt". The batch file uses the information in version.txt to inject the DLL with a version block using this tool.
The version.txt is included in my project to make it easy to modify. It looks a bit like this:
#set #Description="TankFace Utility Library"
#set #FileVersion="0.1.2.0"
#set #Comments=""
Basically the batch file renames this file to version.bat, calls it, then renames it back to version.txt afterwards.
The Problem
When I modify version.txt (e.g. to increment the file version), and then press F7, the build is not seen as out-of-date, so the post-build step is not executed, so the DLL's version doesn't get updated.
I really want to include the .txt file as an input to the build, but without anything actually trying to use it.
If I #include the .txt file from a CPP file in the project, the compiler fails because it obviously doesn't understand what "#set" means.
If I add /* ... */ comments around the #set commands, then the batch file has some syntax errors but eventually succeeds. But this is a poor solution I think.
So... how would you do it?
This works in VS2005. If you're not using that, some of the settings may be in different places or with different names.
Add the text file to your project, right click on it in the Solution Explorer and select 'Properties'. Under Configuration Properties > General make sure that the file is not excluded from the build. Under Custom Build Step > General, put your existing post-build command as the Command Line setting. Make sure you specify your .txt file as the output file. Now F7 should spot changes to the text file and run your batch file.
This may be too "hacky" but this might work:
Write a quick Perl (etc.) script to check version.txt has been updated.
If the file has been modified, have this script update a dummy source file that is compiled with your project.
Run the script as a pre-build event.
This way if the script sees that the file has changed, it will change the other one, which will force a re-build.
Hacky, but try it if you're scraping the bottom of the barrel.

Resources