new solution not loading some projects - visual-studio

I am using TFS 2012 (online version).
Situation:
I made a solution that had multiple projects inside of it. I added it to TFS via the Visual Studio interface ("Add solution to Source Control"). That all worked fine.
Later I decided on a radical redesign of the code. I was not sure if I wanted it to go beyond the concept so I kept it local.
Now it is something I want to use. The new version has two projects that have the same name space as two projects in the old solution. When I add this solution to TFS the two projects that share a name with a project in another solution do not get added to the new source control "folder" (for lack of a better name).
OLD Solution:
myapp.webstuff
myapp.model
myapp.dal
myapp.interface
NEW solution:
myapp.mobilestuff
myapp.model <-- not added to source control
myapp.dal <-- not added to source control
myapp.webservices
TFS
Folder: BuildScripts
Folder: OldSolution
Folder: NewSolution
I think it has something to with the name of the two projects being the same. It must view them as the same and not load them to the source control.

I figured it out. Although the projects themselve would not be added to the source control library, adding files in the project to the library would add the project.
So just add the files in the project and the project will come along.

Related

How can I move common code into external assembly to be used in Unity 3d projects?

I have to share some code between multiple projects in Unity. This code is under constant changes during work on projects. So I need my code to be shared as separate assembly and be included in each Unity solution in Visual Studio 2015.
What is the way to make changes in common assembly so that it automatically updates for other projects and for Unity editor?
Your solution is in submodules with version control. You have one repo for the main project. Then you have a folder within that is another repo. This one is a submodule. It appears grey on your main repo and does not go into commit.
https://git-scm.com/book/en/v2/Git-Tools-Submodules
It does work with other version control systems.
The point of that pattern is that you work on project A with utility-submodule. utility is a folder inside Assets folder. Then you modify Utility.cs and push it on Utility repo.
Project B is using utility-submodule and make a pull, your modification are there without altering the rest of Project B. Obviously, this includes all the hassle offered by version control, that is, conflicts if Project B has worked on utility, probable breaks on other projects if you change the implementation of utility and so on (nothin unusual though).
On the other hand, it is an easy way to pass common code over independent projects.
Let's say I have my shared project here: c:\UnityProjects\DesignPatterns\
and need to include in my Unity project here: c:\UnityProjects\Game\
Solution:
Move all shared code into separate project (c:\UnityProjects\DesignPatterns)
Include this project in solution for all your Unity projects. This allows you to make changes once you need them without reopening shared project separately.
Everything works fine at this moment except Unity editor can't see your external assembly. You have to copy it into any assets folder in Unity. Unity will automatically detect it and create .meta file. Let's create folder for this: c:\UnityProjects\Game\Assets\ExternalDLLs\
We don't want to copy recently built assembly into this directory, we want make it automatically. And Visual Studio post-build event command line is here to help with that. Right click on CSharp project and select properties, then go to Build Events tab and add the following line into post-build event command line:
xcopy $(ProjectDir)..\DesignPatterns\bin\$(ConfigurationName)\DesignPatterns.dll" "$(ProjectDir)\Assets\ExternalDLLs\DesignPatterns.dll" /Y
Now each time we make solution build this command copies our dll from output folder of shared project into our project's asset folder.
Please note: shared project must be built before your unity code assembly is built. It is the case when you always make solution build. In other cases consider copiing assembly from Unity temp directory (you have macros for this folder to select).

How to reference TFS item within multiple projects

I have a C# solution I created within Visual Studio 2010 Ultimate that contains multiple projects that make use of the same structures, classes, and enumerated types. I have created a .cs file that contains all of these items, but at the moment I have to make a duplicate of this file for each project. This is obviously less than ideal because I have to remember to update each copy of the file should I make a change or addition.
Is there are way I can have all of the projects reference just one actual copy of this file, so that I only have to update it once and all of the other projects can see this update? A colleague of mine told me it was possible to make some sort of "symbolic" reference in TFS, but since I don't really know what the name of this feature is I don't know how to research it further.
This question has answers that suggest either creating a class library or using "Add as link" when adding an existing item. I suppose I can do this in Visual Studio when not using TFS, but I have posed this as a TFS-specific question. Will this "add as link" option work when TFS is in use or do I have to do something in TFS to get it to honor the link reference?
"Add link" option would definitely work with TFS. You dont have to do anything specific for that. "Add Link" is project specific and it will add a new entry to your project file specifying the location of your .CS file. As long as the file is available in the particular location during server build, there is nothing to worry. Make sure that the Add link makes a relative path to the file and not absolute.
In my company, we have multiple projects within a solution and we share a single "Assemblyversion.cs" for all the projects so that I dont need to write version info in multiple files. We have made use of Add Link and it works great!

How to use assemblies in a VS solution under source control and keep assemblies updated?

(I no longer want an answer. OML, my English has surely improved...)
How to use assemblies in a VS solution under source control and keep assemblies updated?
(Source control is provided by the codeplex and VS default options for it.)
I mean,I have a project named HyperAero.
I have another project named TestAnimation.
TestAnimation is under source control and needs hyperaero.
When I check in,HyperAero.DLL will not be saved in server.Of course,I can add hyperaero.dll to my solution as a file but I want it to stay updated with my changes in HyperAero project automatically.
What should i do?
Answer (Got it myself):
command:
robocopy "E:\Documents\My VS\Fix soft HyperAero Form\Fix soft HyperAero\bin\Release" "E:\Documents\My VS\Fix soft Animation Maker\Test of Animation Maker\DLLs" "*.DLL"
set rce=%errorlevel%
if not %rce%==1 exit %rce% else exit 0
Similar Question (Remember that i want my assemblies to stay updated):
When using custom assemblies in a visual studio project. How does one check in those assemblies in source control with the project so that anyone can download the project and build right away.
There are two way to approach this:
1/ Don't put the assembly dependencies in source control and always include in your solution their Visual Studio project instead. In your case you'd have a solution with the Hyperaero project and TestAnimation project with a project dependency to the Hyperaero project.
This way you don't have to put the generated DLL in source control and keep it updated each time you change something in the code.
2/ If you really want to dissociate both projects, then I'll recommend you to use Nuget and build a Nuget package for the Hyperaero project and then reference the Nuget Package in you TestAnimation project. This approach is the cleanest one, but it may be overkill and at last it's not something you'll setup quickly (compared to 1/).
Put both projects in the same solution and add a project reference.
Use your source control's UI / command-line to add the DLL files.
What source control software do you use?
If you are using subversion:
ankhsvn (Visual Studio plugin) can handle multipe repositories in one solution.
I have the following structure.
- App1\
App1.sln
App1Forms\
App1Forms.csprj
- App2\
App2Dll\
App2Dll.csprj
Now If I open App1.sln and add App2Dll, which is outside the folder structure, as a project, the project gets linked as a relative path. I am fine, if I check out both sources to the same parent directory.
Ankh is aware of that and If I hit update both projects gets updated.
If I want to commit changes I am only allowed to commit to one repository at a time, but again, ankh informs me about that.
Another way is to use svn-externals http://svnbook.red-bean.com/en/1.0/ch07s03.html
which will transparently include one repository inside another.

Visual Studio 2010 2 projects in 1 solution

I have Console version of app, developed earlier and want to have MFC visualization of it, but with ability to run Console version too. Is it possible to add new project next to existing Console project in the same solution?
Also, I have to link libraries statically.
Yes absolutely it is possible, that is what a Solution file is for. All you have to do is right click in the Solution Explorer and add a new project, the solution file will be created for you.
If you do have multiple projects, you can also specify to start more than one of them when you want to debug, just right click on the solution in Solution Explorer->Properties, Common Properties->Startup Project, then select the Multiple Startup Projects radio button.
Yes, you can have many projects in one solution. Not sure, that you can reference exe file as library for MFC project. For CLI project, yes - you can do that.
Yes you can - add a new project and add files to it. You don't have to link statically, you can link exactly as you want. In fact, you can also copy the old project file edit its contents to rename it and add that to the solution and then remove/add particular files you want.
Its not like C# where you have to mirror the on-disc layout of your project files, C++ files can be referenced where-ever you like.
An alternative would be to add a new build target (eg debug, release, and add 'console - debug' and 'console - release'), then you can mark files as excluded from the builds based on their target, so you can have 1 project that builds 2 slightly different versions of your project.

Visual Studio Solution Template - Link Source Control Projects

My team is creating some standard VS solution templates. We have a well-defined project structure, resources, etc. that we need to use every time we start a new project and this is the perfect solution. The basics work nicely.
However, as well as defining folder structure (etc.) it would be nice to be able to import a number of projects from VSS/TFS. We have a number of shared assemblies that will be used by all projects and it would be awesome to add a reference to these projects when creating a new project via our template. Can anyone tell me if this is possible and, if so, how it can be achieved?
I think there are 3 types of items you might want to templatize (is that a word?).
New Solution
New Project added to a solution
New item added to a project
I'm not sure whether its possible to add existing projects to the solution that is created when a project template is run. http://msdn.microsoft.com/en-us/library/ms185308.aspx shows how to create multiple project templates. You may have to either manually add them to the solution or create a script that modifies the .sln file to do that part.
Adding an assembly reference to either a project or item template is easily doable. The project template is pretty simple since you just need to modify your .vstemplate file for the project template(s). See http://msdn.microsoft.com/en-us/library/ms171405.aspx for reference.
Adding a new assembly reference when you add a new item from a template is a bit harder but can also be done. See http://msdn.microsoft.com/en-us/library/ms185290.aspx for more.
Have fun!

Resources