How to regenerate designer code for all SpecFlow features - visual-studio-2010

I've got ~30 SpecFlow feature files, and I recently removed the Foo.feature.cs files from source control because I got sick of resolving merge conflicts in Designer Generated code.
I did not exclude or remove these files from my Visual Studio project, so Visual Studio still thinks they should be there, they are just missing on the hard disk.
Ideally I'd like to just click on a root folder and regenerate all the code behind files, but no such option exists for VS 2010 and SpecFlow 1.9. I'd even be OK with programmatically regenerating them from the command line, creating another custom tool or adding a pre-compile build event.
Is there a way to regenerate all of the the Designer generated code behind files for SpecFlow features (*.feature.cs files) without right-clicking on each .feature file and clicking "Run Custom Tool"?

You can right click on the project and choose 'regenerate feature files' to do them all at once.

It runs much quicker from the command prompt. Go to your Specflow package tools folder and run the following command line. It also ensures the correct Specflow version is added to the files.
specflow.exe generateall <My_Testing.csproj>

Related

Can I create a Visual Studio 2019 project from existing C code?

Here is my current setup:
Some C code (some embedded code) in a folder and subfolders. Organised as I needed and how the embedded editor needed.
If I use Eclipse to create a new C project and place the project file in the root of my sourcecode, then Eclipse will find all folders and files, then index them correctly. I then able to browse the files as a project, functions linked to other files, defines are showing up correctly.
Now, our version control is Visual Studio 2019, and I'm looking for a solution or guide, how to open the same file structure in visual Studio instead of Eclipse. I don't want to open the Eclipse project, I try to drop the use of Eclipse, so I can just use one tool to version control the files and browse the code for editing. I also don't want to compile, debug in visual Studio, I can use the dedicated environment for that. I only want to edit the files like it would be in Eclipse, save the files as the VS editor is much better than the embedded editor. (By the way, the embedded studio IAR and it's editor is horrible, hence why I used Eclipse in the past, but I don't want to open IAR project in VS, just a nice editor needed from VS.)
Any suggestions? Anyone done this successfully?
When you open VS2019 directly (i.e. not via a source or project file) you should be presented with a start page that includes this:
Select "Open a local folder" and it will present the project from the root you select. It will even apply IntelliSense for code completion for symbols within the selected code base. For headers external to the project tree, you can add include search paths to get better navigation, browsing and completion.
A more comprehensive integration with IAR is possible using VisualGDB extension as described here.

Visual Studio 2015. Files not added to TFS

I'm using Visual Studio 2015 update 3 with TFS hosted at visualstudio.com.
When I add a C# class file to one of my projects in Visual Studio, it's not automatically added to source control. For other projects in the same solution, C# class files are added automatically, as expected.
When I then add the file, manually, in the project with this problem, I get the following question;
I have to confirm to add the file to source control.
There is a similar question (Visual Studio 2015 new files not being added to source control automatically), associated with a "release" branch, which is not the case here (at least I think so - our TFS-project has never been branched)
We've never configured any .tfignore manually.
This started to happen recently and occurs on all development machines, so it's probably not a client machine issue.
I'm clueless, so any help is highly appreciated.
UPDATE
I've discovered that the problem occurs in projects with names ending with ".Lib"
Projects:
Core (ok)
Core.Lib (files not added automatically)
Communication (Ok)
Communication.Lib (files not added automatically)
I tried to add a test project Test.Lib to my solution. This project was not added to TFS either, but project Test was.
The "lib" extension is the problem. Try renaming the project folder to something else, eg. "CoreLib".
To reproduce this behavior / bug, try the following:
Create a Test directory in a directory controlled by TFS
Create a Test.Lib subdirectory in this directory.
Add a file, test.cs, to Test.Lib. (Test\Test.Lib\test.cs)
In Visual Studio's Source Control Explorer, try adding the new Test directory to source control. You'll see test.cs on the "Excluded items" tab.
The "lib" extension is used by binary files, and these are ignored by Team Explorer by default. I haven't found an official list of filetypes anywhere, but other affected file types are dll, exe, obj and possibly others. You can include these files manually by right-clicking them and selecting "Include".

Clearcase does not checkout project files when files are moved by resharper

My current project is under source control by clearcase. I am also using Resharper 8.1 with Visual Studio 2012. I am also using a VS integration for ClearCase.
When adding files manually to a project (by right clicking on the Project -> Add-> Class), ClearCase checks out the project file, so that saving all files works like a charm.
"Unfortunatelly", I tend to use a lot of the ReSharper functionallity. When using ReSharpers Move To command, it seems that ClearCase prevents ReSharper (or Visual Studio) to check out the project files. They are modified, but cannot be saved - I always get that Save As dialogue when saving all documents. To get this working, i need to manually check out the *.proj file and then save the modified files. Is there a way to automatically check out those files?
Another problem is when using ReSharpers Rename: I just tried to use Rename on an interface that is used in approx. 60 other files. Everythink worked, except that the files were not checked out by clearcase! In order to save, I needed to Save all, click cancel for the first file (ClearCase then recognizes that the file has been modified and checks it out) and then save again. This is really annoying and prevents from a produtive workflow..

Dll dependencies on a Visual Studio 2010 solution and TFS

How can I make a solution in visual studio so that the .dll dependencies that reside in some other directory totally different from where the solution itself is affected by "get latest".
What I've tried is creating a Dependencies solution folder within the solution itself and added the dlls to it, that way they belong to the solution even though they don't belong to the directory structure of the solution.
So for example the .sln file is in:
D:\tfs\repository\main\SolutionA\solution.sln
and the dlls are in:
d:\tfs\repository\main\SolutionX\Dependencies\Binaries
What I really want to achieve is to have a foolproof way to build the solution, including the following scenario:
1- Have a brand new installation of windows, visual studio, etc.
2- open visual studio
3- find solution.sln on TFS, double click on it so that visual studio gets every project and files in the solution, and opens the solution
4- successfully build
What happens when I try the Dependencies solution folder approach and repeat the scenario above, it will get all the projects within the solution, opens it, but the dependencies solution contents won't be pulled from TFS (although Visual Studio shows them on Solution explorer), which I think is flawed.
Some suggestions that don't involve creating pre/post build scripts are appreciated.
When you attempt to open a solution for the first time using the TFS Source Control Explorer, you may find that not all of your dependencies will be retrieved - the squiggly line may be highlighting some of your missing References.
One work around is to...
SOLUTION SETUP
Checkout all of your source code from TFS (i.e. Main and all of the sub-directories)
Open your solution in Visual Studio (i.e. MyApplication.sln)
In the solution explorer, create a New Solution Folder called ThirdPartyDll, and then add the appropriate assembly references (i.e. Assembly1.dll, Assembly2.dll,...)
Check-in your solution to TFS
SAMPLE FILE STRUCTURE
Main
MyApplication.sln
Source
MyProjectA
MyProjectA.csproj
MyProjectB
MyProjectB.csproj
Dependencies
Assembly1.dll
Assembly2.dll
You've run into a limitation of the "Open from Source Control" functionality. If you added the solution to source control from Visual Studio you should have seen the following message:
"The project that you are attempting to add to source control may cause other source control users to have difficulty opening this solution or getting newer versions of it. To avoid this problem, add the project from a location below the binding root of the other source controlled projects in the solution."
Open from Source Control will create a workspace mapping for the solutions root directory (D:\tfs\repository\main\SolutionA) but not a separate one for the SolutionX folder which is a peer to SolutionA. On the "new" machine you will need to manually create a workspace mapping to d:\tfs\repository\main in order to get both the SolutionA and SolutionX folder.
Create a solution folder and add the dependencies to it, that way when VS gets latest for the solution it will download these files. A bit brittle as people will need to maintain that folder but it works.
Alternatively create a nuget package and use restore packages on build. It will require a couple of extra steps when you create a new developer box (your nuget package repo will need to be added) but it will work for all projects going forward and is less brittle than the solution folder method.

How do I create a project in Visual Studio not meant to compile?

I've got a Visual Studio 2010 solution that I would like to add a project to that only contains some command-line scripts. This project isn't meant to actually compile/build anything, but I want to be able to edit my scripts with the rest of the solution, and have TFS integration etc.
Unfortunately, in searching I get a lot of results for errors where builds don't happen, or other conditions where specific build targets are implemented. I simply want a non-build project in VS as a visual repository for the editor. I don't want to one-by-one include individual files in a solution folder.
In the build configuration manager (On the Menu, "Build", "Configuration Manager"), there is a "build" checkbox for each project. Uncheck it for your script project.
Could you make a content project, add your scripts to it, then change their properties to "Do not compile"?

Resources