Resharper 2017 custom rules setting - visual-studio-2017

I am working with Resharper 2018. My boss wants me to set some of the custom rules in Resharper tool. Now I would like to know is there any way to set such rules for moving a specific file to a specific folder.
For example, A class name with the suffix “Service” (e.g. AccountService) will be moved to the folder named “Services”. It means whenever I will create a class outside of the Services folder with the suffix Service there will be a suggestion from Resharper to move that file into the Services folder.
Another rule can be, creating a file with .html extension, outside of the “Pages” folder, there will always be suggestions from Resharper to move that files to the Pages folder.
I see that a built-in option available for moving files to the specific folder according to it's Namespaces.
Now I would like to extend this features for the above cases. Please let me know any suggestions or tutorials for doing that.
Thank you all.

Related

Visual Studio: how to control specific configuration parameters on student PCs?

Can anyone tell me how to control default configuration parameters in VS 2017 C++? The scenario is that we generate one sample PC with the software we want (Win10, VS2017, et cetera), and this image is cloned onto about 100 PCs in student CS labs.
The two specific things I would like to control are (1) use of precompiled headers and (2) message C4706 (= versus == in an if condition). There are some others, but these are at top of the list.
I know students could fix this themselves, but so many are confused in the first few weeks of an introductory programming class that I don't want to try that.
A search of MSDN has not been productive, but I probably am using the wrong search terms.
Thank you in advance!
You could also edit the default platform property pages found at \\AppData\Local\Microsoft\MSBuild\v4.0, Microsoft.Cpp.Win32.user.props and Microsoft.Cpp.x64.user.props
I'm not sure how you would automatically distribute those files but so long as you are using MSBuild as the build system anything in those files is picked up prior to project-specific settings.
There are two ways I can think of:
Change the default settings in property pages for each configuration
Create a custom project template with all the project settings necessary. This will only affect new projects created with this template. Also it will keep the default template intact and will probably allow students to experiment a bit more.
For enabling Precompiled header.
Right click your project->Properties->( a property pages window appears)Configuration Properties-> C/C++ -> Precompiled Headers -> (on the right side) Select Use(/Yu) by clicking Precompiled Header.
And for suppressing C4706, set compiler warning to level less than 4
Right click your project->Properties->( a property pages window appears)Configuration Properties-> C/C++ -> General ->Warning Level to less than 4
To retain the settings and share with others....
I do not have proper VS2017.... Can you try as said below.....
First export the existing project settings using
project(visual studio menu)->Export template.... continue and and save the template and make a note of the path....
usually by default the templates is saved in below path as a zip file.
C:\Users\<>\Documents\Visual Studio 2017\My Exported Templates
Now copy the zip file and and put it in
C:\Users\<>\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C++ Project
Check if your template is automatically picked up.
If not open visual studio command prompt tool and run
devenv /installvstemplates.

Eclipse : How to hide a file from Project Explorer?

I'm using the Eclipse IDE for C/C++ running on an iMac, OS X Yosemite.
In my C++ project, I want to hide certain files from the Project Explorer, YET they still be included in the project. I'm trying to run a series of tests for an empirical study I'm doing. Files I'm trying to hide are for test purposes and as such I don't want the participants to be able to see the contents of my test files.
I found the following StackOverflow thread, which does exactly what I want, except for the fact that when I do it, Eclipse excludes the files from compiling.
Eclipse: how to hide custom files in Project Explorer
How can I merely hide the files without excluding from compiling?
Thanks in advance!
W.r.t Project Explorer/Navigator view its not possible to merely hide the custom resources based on name patters.
Refer this post for more info : https://stackoverflow.com/a/2396496/1391924
However note that: In C/C++ Projects view you can hide resources based on your own file name patterns.
Refer this help.

TortoiseSVN and Visual Studio Express 2010

I'm using TotoiseSVN client and Assembla backend in a VS 2010 express project. We have issues with VS folders (or filters) dropping and files sometimes not being added to the project. I notice when I commit the .vcxproj and .vcxproj.filters files are never checked by default even though they should be changing. So I manually check them and told others to as well when they commit.
This can lead to issues if team member A checks out, only changes some code, while team member B has the project checked out and added files to the project. If team member B then commits BEFORE team member A, team member A's project file doesn't have the new files team member B added so now his project overwrites team members B's project file he checked in and now the new added files aren't in the project.
How do we get around this besides having amazing coordination?
CMake is perfect for this.
In case you haven't come across CMake, it allows you to create your entire project's build files in a separate directory to your source files, outside of svn altogether.
A single CMakeLists.txt file in your repository's root would replace all your current .vcxproj and .filters files.
I suspect what may be happening here is that the developers aren't saving the project files when adding new files to them. VS2008 did this by default, but I think that in VS2010 they aren't saved until you explicitly do File -> Save All. As a result it means that the changes are not getting committed. Once your devs do get in the habit of saving the project files before committing then SVN will in 99% of the time handle all the merges for you. The remaining 1% of the time is when someone has done some more major restructuring of the project file or two people have made conflicting changes to the build settings. In these cases you'd have to resolve them by hand.
SVN will never overwrite one person's changes with another, it will always try to merge. So if you're running into this problem it suggests that one person is somehow rolling back someone else's changes, or they don't have the option in Visual Studio set to reload files when changed externally: Tools -> Options -> Documents -> Detect when file is changed outside the environment.
An effective way of dealing with this problem is to set up a simple build server, eg with Jenkins that kicks off a build periodically after there have been some checkins. If the build fails then the person who checked in gets a mail to tell them they broke the build. You can also have a monitor that shows the build status which makes broken builds more visible to the whole team and hopefully encourages everyone to keep the build fixed.

Allowing developer-specific settings in VS2008 Native C++ projects

Is it possible to combine the following properties, and if so, how?
Store in our version control system some Visual Studio 2008 native C++ (VCPROJ) project files for the developers in our team that use this IDE.
Allow some of those developers to tweak their projects (e.g. using debug version of third-party libraries instead of the usual ones).
Make sure these modifications are done in files that are not versioned.
In other words, I would like to allow developers to tweak some settings in their projects without risking that these changes are committed.
An 'optional VSPROP' file approach seems doomed to fail, as VS2008 refuses to load projects that refer to non-existent VSPROP files...
Any other suggestion? Is this possible with VS2010?
You may not be able to do this but using a solution that generates the vcproj like CMake for example would let you do this. Scripts all your project with CMake and literally conditionally include a config file(if present for example) that developers can change on their setup.
Branches could solve this problem: you create a branch, play with different versions of third-party, merge changes to trunk if results are good.
Well, as a preliminary solution you could put the project file into something like .hgignore or .gitignore after its initial commit.
This way changes to it can't be done accidentally.
At least that's how I handle .hgignore itself.
We use a versionned "common_configuration" folder, and a script which copies project files from this "common_configuration" folder towards the "project" folder.
We have another script to copy the configuration backwards, so the developpers need to make a conscious action to commit their local changes to the global version control system.
It answers partly your needs :
The upside : we have a way to keep a common configuration for everyone, and no accidental committing of local configuration
The downside : blindly copying the files actually crushes local changes. We live with it. We could write some more clever merger tool (using diff, or xml specific manipulations), but don't want to spend to much time on supporting the deployment tools.

Flex builder and multiple and potentially duplicated projects in the same work space?

Is it possible have two projects with the same name in flex builder?
Here is the scenario
~/projects/myprojectdev/ProjectName
~/projects/myprojectstable/ProjectName
myprojectdev
and
myprojectstable
are more or less the same tree structure and duplicates of the same codebase.
I am using git to manage them as separate repositories. I can do some stuff in the myprojectdev folder and then occasionally merge changes over to the myprojectstable folder when I am satisfied. But I want to keep code from myprojectstable in my working space in flex builder to be able to launch it and occasionally compare the code between dev and stable. I may also want to open different versions of the same project codebase and compare them in the working environment. The problem is that in both folders the "ProjectName" is the same. And so I can't import both into my Flex Builder workspace. I get the warning
A project with the same name already
exists in your workspace. Rename or
delete the existing project.
But I don't want to rename the project or mess with its folder structure. What do I do? Do I have to keep these in different folders? e.g.
~/projects/myprojectdev/ProjectNameDev
~/projects/myprojectstable/ProjectNameStable
You can rename a project (in eclipse/flex builder) without actually renaming the folder it is in. Edit the .project file in your ProjectNameDev and ProjectNameDev to give the projects different names. You might need to restart eclipse to get it to recognize the new name.