Sharing project in TFS - visual-studio-2012

We are trying to figure a way to setup TFS for our needs. We have, let's say,
Project A, Project B and Framework, a project shared by many projects.
Framework
Project A
- Framework
Project B
- Framework
If the Framework is modified, we want to make sure that every project that
use it has the last version.
We first thought about sharing the Framework by adding it to project A and B using "Add as link"
in Visual Studio, but this would also modify all branches, which is not good. So we thought
about compiling Framework into a DLL and include a copy of this DLL into each project. The
drawback is that the DLL has to be updated manually for each project.
What is the best way to share a project in TFS?

There is no 'sharing' as such in TFS as-in the way you could with Visual SourceSafe. You have 3 options
Use branching and merging. You branch Framework into Project A and Project B. If changes are made to the framework, the project teams will have to merge them into their project. If they make changes to Framework in their project then they will have to merge back to Framework to allow other projects to consume the changes.
Use Workspace Mappings. Essentially this is setting up sharing. When I do a get on my ProjectA workspace, it would also get the code in Framework to a subdirectory that I can reference in ProjectA. Any changes would be propagated to Framework and all the projects as soon as they did a get latest.
And probably the best solution is to use something like nuget. Your Framework build would package and publish the latest version which would then be consumed by the Projects. You could choose to stick with a version or pull the latest at build time.
TFVC Gems - should cover the first 2 options
Dependency Management with NuGet.pdf - talks about option 3

I'm assuming that we're talking about a .NET set-up, if not then this might not be relevant.
I believe that if you have a reference to the framework project (rather than the compiled DLL), then every time you recompile your projects, you will pick up the latest version of Framework (obviously, this is dependant on your branching structure).
Another thing to consider, if the above doesn't work, is to use a build to recompile the dependencies first.

Related

Specify C# version in ReSharper

I'm slowly migrating projects to VS2017 from VS2015. We have distributed team and until all is verified (there are issues with e.g. Reporting Services, SSIS, etc as there is not fully finished tooling - SSDT) I need the projects could work in VS2015 without changes.
C# projects in VS2017 use latest C# version by default in project settings (in my case it is C# 7.1) and ReSharper started to offer refactoring to these new features. However, I need to resist the temptation and wait until all is migrated (while I still need to be able to write and review code). I need to specify the version of C# to be 6.0. I can do it on per project basis but I would like to avoid this as I would have to go through each project, modify it and push it to source control and when the migration is done then I would have to switch it back.
Is there a way in R# to globally set the C# version in options (haven't found such a setting but maybe there's some hidden option?)
(VS2017 - 15.4.5, ReSharper 2017.2.2)
EDIT
For Typescript there is possibility to specify language level - either auto-detection or exact version. So for C# it could be similar - auto-detection from project settings or exact version. It would allow code review for specific language version without modification of the projects.
I'm adding here also the link to R# support page as I asked there too
Add the following string to solution settings file ({Solution name}.sln.DotSettings file in the solution's root folder)
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/#EntryValue">CSharp60</s:String>

Prevent a project from building if a dependent project fails

I have a VS2010 solution that includes a custom project. The project builds an installer out of all the libraries and executables built in the same solution. This is a third-party installer builder, not a native Visual Studio installer project. It runs a custom command in the post-build event of the project.
The problem with this setup is that the installer project build runs (and succeeds!) even if some other project build fails.
I have added project dependencies so that the installer project depends on all other projects, to no avail. I have also tried to add project references with the same result.
This happens only with this specific project (probably because it's a custom project with configuration type "utility"). Other projects don't start building if a dependent project fails to build.
This is a dangerous situation. A developer may not pay attention to a build failure in some other project and use the incorrectly built installer. I need MSVC to skip building the installer project if some other project fails.
How should I deal with it?
Ideally this should be solved at the MSVC level. I don't want to add custom checks to the installer build command because this would mean I have to maintain a list of projects/targets in two separate places. I also don't want to introduce additional tools to the picture.

How to put existing IntelliJ and Android Studio projects into local Subversion repo?

I just created a brand new local subversion repository (c:\svnrepo) with the following steps:
mkdir c:\svnrepo
Opened c: in Explorer, right-clicked \svnrepo, and selected TortiseSVN->Create Repository Here
Had TortiseSVN create the default directories.
Now... I have two existing projects that I want to move into the repository. Let's call them "mylib" and "myapp". If it makes things easier, I can create a separate repo for each project instead of dumping both of them into different subdirectories of one big repo.
mylib is an IntelliJ project. It's a Java library, and currently inhabits c:\src\mylib
myapp is an Android Studio project. It's an Android app, and currently inhabits c:\src\myapp
Now is the point where I'm struggling. I used to know how to do this with my eyes closed, but it's been a few years since the last time I've had to create my own local Subversion repo from scratch, and I've basically forgotten how to do it. Plus, the last time I did it, I was using Netbeans (Java), Eclipse (Android), and SyncroSVN.
I vaguely remember that the procedure goes something like this:
Import the project (say, c:\src\mylib) into the local Subversion repo, add all the files, and commit them... but first, configure subversion to exclude all the files and directories that shouldn't be under VCS. I'm pretty sure there's a convenient way to do this in both IntelliJ 14 and Android Studio... but I don't know what it is (the last time I did anything like this, I was using Eclipse and SyncroSVN). At this point, I'm not even sure which directories and extensions SHOULD be excluded, because every online tutorial I find seems to have a different opinion (compounded by the radical changes Android Studio has made to its project directory structure with seemingly every single major new release).
Move c:\src\mylib and c:\src\myapp to c:\backup for safekeeping, then from c:\src, check out mylib and myapp from the Subversion repo. Once again, I'm pretty sure IntelliJ 14 and Android Studio both have a workflow to do this all in a single step, but I don't know what it is.
In theory, after I've done steps 1 and 2, I should be able to reopen the projects using IntelliJ or Android Studio, and the only difference is that they should both now be aware that the projects are under version control & somehow visually indicate files that differ from the repository copies.
What's the current proper way to do the steps above to get my two projects under Subversion control?
I have the following installed:
svn commandline client
TortiseSVN
SyncroSVN
IntelliJ 14.1.5 (yeah, it's about a year and a half behind the current release... my subscription lapsed, so I'm stuck with the version I had last May).
Android Studio 2.1.2
Just to be clear, I remember that there are two ways to organize a Subversion repo... either as a single monolithic project where the actual Java/Android projects are subdirectories of trunk, tags, and branches... or as separate repositories with one project apiece (each of which has its own trunk, tags, and branches). Either structure is fine with me. I just feel like I'm going in circles right now & desperately need a few nudges in the right direction.
First of all, install Subversion server on your machine. You could use http(s) URLs instead of awkward file:// access schema.
In any case, here are the steps that should work in Android Studio and IDEA both:
Open your project.
Select VCS | Enable version control integration.
Select VCS | Import into Version Control | Share Project (Subversion).
For Repository Location enter file:///C:/svnrepo/ or https://svn.example.com/svnrepo/ and select the project structure you need.
Select Share.

Catel 4.0.0 and Dependency on Microsoft.Bcl.Build

When updating a project to use current Catel version (4.0) I am getting this warning:
All projects referencing MyInfrastructureProject.csproj must install nuget package Microsoft.Bcl.Build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317569.
The error is reported for projects that references MyInfrastructureProject.csproj.
I find it odd that I need to add additional libraries to other project especially when it is concerned with nuget (if I am getting the picture correctly) and not with actual functionality of my code (or maybe even Catel). But in any case, I don't really understand the issue.
I searched a little for this issue but didn't find relevant details or explanations.
Should I go ahead and add the Microsoft.Bcl.Build reference everywhere in my project?
Thanks,
Tomer
If you don't know what is Microsoft.Bcl.Async you should study it.
Catel uses this feature pack so as to use async/await on .NET 4 and Silverlight 5. So if you use Catel in a .NET 4 project, you inherit the same dependencies, which is what the warning says.
Thus, yes, please go ahead and add the NuGet package to the necessary projects, or simply upgrade your projects to .NET 4.5 and reapply the NuGet packages.

How can i tell visual studio to rebuild project when dependant library has been rebuilt

In my solution i have two projects.
One is a library that generates a .lib file on build.
The other is a test application using the library.
I have set the test project to be "dependent" on the library project.
However when i make changes to the library and press F5 to run the sample, it does not rebuild the sample. The dependency option only seem to make sure that the library is built when running the sample.
"On run,when projects are out of date" is set to "always build".
I'm using vs12.
you have set the Test project dependant on the Library but for this scenario you want that reversed.
Visual studio will not allow you to have a circular reference, so you will have to remove the project dependency for Test to Library and re-add it as Library to Test while you are working in this way.
The most common scenario would be a client app(Test) that is dependant on the Library and any changes on the Library would require a manual rebuild of the client, due to the fact the Library change may have broken signatures, types etc.

Resources