0

we are working on a market simulation program using C++ and we would like to keep track of the changeset when that simulation is run, as the program is changing over time. We need to store the changeset value to a text file that contains the simulation results. I'm working with some students on it at a community college. We found the library that has the functions that we need, "Microsoft.TeamFoundation.VersionControl.Client.dll" and its location in the file system, but we can't reference this library to use the function we need. Visual Studio doesn't give us the option to reference this library. We also tried some NuGet packages that contain this class, but they didn't install because NuGet package didn't "not contain any assembly references or content files that are compatible with that framework".

"Attempting to resolve dependency 'Machado.Microsoft.TeamFoundation (≥ 12.0.0.0)'.
Installing 'Machado.Microsoft.TeamFoundation 12.0.0.0'.
Successfully installed 'Machado.Microsoft.TeamFoundation 12.0.0.0'.
Installing 'Machado.Microsoft.TeamFoundation.Client 12.0.0.5-beta5'.
Successfully installed 'Machado.Microsoft.TeamFoundation.Client 12.0.0.5-beta5'.
Adding 'Machado.Microsoft.TeamFoundation 12.0.0.0' to FOR_REAL_THIS_TIME_GUYZ.
Uninstalling 'Machado.Microsoft.TeamFoundation 12.0.0.0'.
Successfully uninstalled 'Machado.Microsoft.TeamFoundation 12.0.0.0'.
Install failed. Rolling back...
Could not install package 'Machado.Microsoft.TeamFoundation 12.0.0.0'. You are trying to install this package into a project that targets 'Native,Version=v0.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author."

Any help would be appreciated.

MSalters
  • 173,980
  • 10
  • 155
  • 350
  • Of possible value: http://stackoverflow.com/a/33505176/425871 – Steve Jun 21 '16 at 20:54
  • 2
    I suspect the main problem here is a lack of understanding. You haven't told us where this changeset number is coming from, so you don't realize that's important. You seem to confuse C++ and managed languages. You thik you can grab random DLL's to get "functions you need". Most importantly, you appear to have an design problem. You need a build number, but think about calling a DLL. But building and running code are distinct phases. – MSalters Jun 22 '16 at 08:25
  • @steve the link helped us add the NuGet packages with the classes we needed, but we still can't add a reference to those classes. No option pops up when we go and try to add a reference library to our project. – Gildardo Orozco Jun 22 '16 at 17:46
  • @MSalters, I think you interpreted our situation pretty good. Since the changeset of the latest change to the program is somewhere in Visual Studio, we expected to find a class that would allow us to include a function into our program that would be able to reach in and get that latest changeset number. We can't seem to be able to add a reference library to our program, so that's hampering our ability to try and add a library to see if we can just grab that changeset number. – Gildardo Orozco Jun 22 '16 at 17:52
  • @GildardoOrozco: You are aware that the normal mode of running Windows programs is outside Visual Studio? And even when debugging, it's Visual Studio looking at your program, not the other way around? – MSalters Jun 22 '16 at 21:16
  • @MSalters: Thank you for clarifying that, it makes the answer bellow much more clear now. – Gildardo Orozco Jun 23 '16 at 15:13

1 Answers1

1

Your program will want to know the version of the source it was built from, not the current version, so it shouldn't be trying to access source control at run-time.

As part of your build process, add a pre-build event which executes a program that writes the changeset number to a file. Depending on your source control, there may already be a command line tool which does this, or you may need to create one with a small C# program and the library you are trying to reference.

Pete Kirkham
  • 48,893
  • 5
  • 92
  • 171