I have 1 large solution (about 100 c# projects and 20 c++ projects) in VS2010 + Resharper.
Well known steps for c# project renaming :
Rename project via project explorer.
Open project properties (right click) -> rename "Assembly name" and "Default namespace"
Open Assembly Info file -> rename neseccary properties in this file
Remove renamed projects from solution
Rename projects directiories on file system
Load renamed projects
After performing these steps for some C# projects (for example I renamed 10 projects), Visual Studio 2010 hangs. Work with the solution becomes fully impossible. It occurs on any machine when I try to open this solution.
The goal is to rename all projects. For example, every project's name pattern is : XXX.YYY.ZZZ and I want to rename them all according to a new pattern : YYY.ZZZ.
With more than 100 projects in two different languages it is very normal for VS2010 to freeze.I have about only 45 projects , Changing a class name freezes VS for a noticeable amount of time.
Then even though tedious i switched to Find and Replace,Basic but doesn't freeze VS..There is no other go. You have to deal with it.
Btw VS also needs a Huge database for maintaining c++ references and parsing information.
Related
I develop on a large web API that contains eight C# projects. Often, I am switching between branches within our repository to work on different tasks. I use Git Extensions as my tool of choice to work with Git, and whenever I checkout a different branch, Visual Studio will prompt me to reload the projects (if changes are detected). I normally select the "Reload All" button. After doing so, I keep getting errors being caused by what seems like left over changes from the branch I was previously on.
For example, if I am on branchA, which introduces a new file that contains a C# class, reference that class in someway in another already existing file, and then checkout branchB that doesn't contain these changes, Visual Studio will start to produce The type or namespace name 'name' does not exist in the namespace (are you missing an assembly reference?). This also seems to happen the other way around, where if I switch to a branch that introduces new changes not on my previous branch, these errors crop up.
It seems as if the .csproj files for the projects aren't being detected as updated after selecting the "Reload All" button. Evidence of this is that Solution Explorer still shows these files, but with red "X" symbols on them, denoting that the projects expects the file to be present, but it currently is not present on disk. I've made sure that the .csproj files do in fact get updated after changing branches. The only solutions that work for me currently is if I right click on the project(s) and unload then reload them, or if I close the solution/Visual Studio and reopen - both of which are tedious.
I am confident that this was not the behavior previously witnessed in prior versions of Visual Studio. I use to be able to freely switch between branches and not have this happen in the past.
Could something be out of sync? How can I resolve this?
This is with Visual Studio 2019 Enterprise (version 16.10.3).
Faced the same problem after updating Visual
In 16.8 version Microsoft added new Git experience that broke the "reload all" feature.
You have two ways to work with this:
Go to Tools → Options → Environment → Preview Features. Turn off the option "New Git user experience."
Use the Visual studio git panel to checkout (Git → Manage branch).
If you reload projects one-by-one instead of clicking Reload All, it should update them correctly. Not a solution, but a slightly-better workaround until it's fixed.
Unchecking "New Git user experience" doesn't work for me, hence this alternative approach.
For a school project we developed 2 different projects (2 solutions). Now we need to merge them together to form 1 Windows 8 Store App.
I added Project2 to the solution of Project1. But I ran into some issues.
Each project has an .appxmanifest-file. If I keep both files, VS 2013 will complain because the logos are set in both projects. The error message is:
Payload contains two or more files with the same destination path
'Assets\Logo.scale-100.png'...
I tried deleting 1 .appxmanifest-file but then VS complains about missing the file.
Deleting the logos out of 1 manifest also gives error messages.
How can I merge these 2 projects without these issues?
Basically you can't.
This type of project is designed to work as standalone application so you can use them both in one solution.
What you should is to decide which one you want to leave as main project, then add "class library project" to this solution and import all needed files from the other solution
I have 100 and above in my cs files in my cs project file , and it is very slow even if i type some namespace or class name in the visual studio editor it is taking around 3 to 4 seconds to respond. Can any one help me on this i cannot remove the cs files from my project is there any workaround for this.
Thanks in advance
PS: May be this can help i am using clear case as my source control will that effect the performance of the visual studio .(My version of visual studio 2010 express edition)
You must be using a lot of unnecessary references in your project. Just go to the references section and delete those extra references.
There should be no problem with large/many .cs files. I have also solutions with 20 projects, some of these projects have many many files and some of these files have 2k - 5k lines of code. And I've no problem typing new code, there is no noticeable delay.
Perhaps it's only because of slow hardware?
I am creating code generation tool as windows forms application in visual studio 2010 in framework 4.0.
I want to build .csproj file, assemblyinfo.cs and .sln file dynamically including the some class files I have created so that when I click on this .sln file it is opened as project with all class files that I have generated.
It means that when I click on generatesolution button, a new project should be created with all folders automatically, that are created when we create new project from visual studio.
Please help me.
You would be better off using Visual Studio's automation capabilities rather than trying to generate the files yourself - there's an article on MSDN "Controlling the Solution and Its Projects" which gives an overview of the process of generating a olution, though it's a bit short on detail: there's also sample code in the documentation for the solution2 interface which shows how to create a console app solution, and an article on How to Programatically create projects.
Hopefully this is enough to get you started.
To create a project programatically, you can use Microsoft.Build.Evaluation.Project (MSDN documentation) and for the solution just use EnvDTE (MSDN documentation)
What is a solution ? I think a file which contains references and properties .
So what is the project file , It has some information about the forms and classes.
Basically we can write into a .sln file something like this :
Solution Name : Sol1
Projects : 1
References : System,System.Text,System.Linq
and for a project file :
Forms Count : 4
Classes : 8
Folders : 2
Resources : 0
Silver light : N
Web : N
Type : Windows Application
Directory : C:\Dir
Framework : 4
Parent Solution: Sln1
Or you can create data structures(class) for solution and project.
But it's better to Contact MSDN and get their own data structre and headers for .sln file.
Perhaps you could create a plain vanilla solution/project using Visual Studio with the bare minimum you need, then use the files created as a template for your code generation procedure.
You would need to change the project files to reference your generated files though. A .csproj file is just XML so it should be quite easier to alter that - look at how it adds sources files as a guideline. A .sln file would be a bit trickier to edit as that is a custom format, but I guess some kind of string replace/RegEx could work.
I want to create an hour counter to monitor my development time on a project. I want the time to increase whenever a certain project is active in Visual Studio 2008.
Can I progammatically find out which *.csproj file is currently active in VS2008?
You can get the loaded solution via the DTE.Solution property, and the active document via DTE.ActiveDocument. There isn't really an "active project" because you never really activate projects, you only open solutions (which can contain multiple projects) and files (which happen to be in projects).
I suspect for a time-tracking requirement, getting the current solution would probably suffice. However, if you need to specifically distinguish between projects in the solution, you can do this using DTE.ActiveDocument.ProjectItem.ContainingProject.