In VS2008, I have a web-site project. When I use find in files and search for a string, the find results window will list every occurence twice.
What could be causing this?
[EDIT]
Below is the screen capture from VS. I was searching for the work CommissionBucketProductID within my website project. Notice that each line is returned twice.
[EDIT2]
In response to your questions. I am only searching within the project, not the whole solution. I currently don't have these files under VSS, although they were in the past.
I had the same issue which was annoying. I just fixed it. What I've done is to change "Entire solution" to "current project" in "Look in" field when doing search. Then I noticed the result would not be doubled. After I switched back to "entire solution" the problem was gone.
If you do find in "Entire Solution", it also searches in any loaded files, even if they're already in the solution. This means that they'll be listed twice.
Perhaps this is your problem?
I use VS2003, but I get this exact result when I have the same source file in multiple projects. Are you sure you aren't searching more than one project?
Here's your answer:
Find in Files searches same files twice
This seems to happen for files that are shared between multiple projects in the same solution, causing them to get searched twice. Since the problem exists in VS2010, it must have been inherited from VS2008, which probably means you're pretty much out of luck (unless you work around it, such as by separating the projects into multiple solutions).
But in the meantime, it sounds like it's not high enough on Microsoft's priority list to get this fixed.
Do you have any symbolic links to a directory/file within the same search scope? This could cause the file to be listed twice: once for the primary file, and once for the link to the file. Although from memory it should show the directory of the link for the 2nd occurrence, not the file pointed at by the link (and this is inconsistent with what is in your screenshot).
Try closing VS2008, renaming the file (USPostalApplciation.aspx and the code behind file too), then re-opening VS2008, refresh everything you can think of (project, solution, etc...) then try doing the search again.
I had a similar problem. VS would turn up find solution results from files I had loaded in the IDE just to view them and then closed again. So it would search through files that weren't even in the solution.
I scanned all files in the solution, but there was no reference to these phantom files stored anywhere. Finally I decided to scan the registry and found that they were stored in the MRU list. After deleting the MRU list entries, the expected behavior was restored.
Make sure your web project does NOT have any virtual directories that point back to other areas of the site.
Verify that VS2008 shows the same virtual directories (if any) that IIS has.
If you have mis-pointed or mis-configured Virtual directories, it will cause a HUGE performance hit, search result replication, etc.
This is an old thread, but this still happens.
As new info, I just found that the solution contains a Setup project, which naturally references some of the projects, besides the solution itself.
In that case, when searching the Entire Solution there are two routes to some files.
Related
I am adding a test project to many solutions in our project's primary git repository.
In the process, I noticed that adding a "Solution Folder" to the .sln file modifies many of the projects in the solution. I can think of no logical reason this would be the case. I am only talking about adding the solution file, before I add the test project.
All of the projects in the solution are C# projects, if that would make any difference.
Does anybody know why this is the case. Is this intended behavior, or a bug? Also, is there any way to prevent this from happening?
The two images below highlight the behavior I am talking about:
Before adding the new solution folder:
After adding the new solution folder:
As far as I can tell, the changes are meaningless:
It's a bit weird, but these things happen when people have multiple solutions and fix the casing in one Solution, but not the other. When the project file is re-rendered (because a project is added, renamed, solution item changed etc), then it will pick up the corrected casing. If the solution file has the 'correct' casing, nothing may change, but if the solution file mismatches it can cause this cascade.
Fixing the casing in one solution may trigger the reverse behavior in another solution. Hence, this must be fixed in all solution files at once. Be careful if you have multiple branches.
The best way to fix this is to fix the casing issues on the file system, project files and solution files in a single go. Doing it with a text editor is usually easier than through the Visual Studio project system. Regex search&replace can do wonders here. Make sure you fix all of these at once:
The contents of (all of) the solution file(s)
The .*proj file causing the problem
The file system path (you may have to change more than the case first for the case change to take). Also make sure your Version Control system will take the change.
The project references in other .*proj files
When the casing of a single project is fixed, the change may cascade to other project files that reference the problematic project. The ProjectReference element in the project file has a relative file system path to the problematic project and also captures its name. You can see this clearly in the screenshot you posted:
Our company won a web project from a new client. Their old vendor basically zipped up the code (C#/ASP.NET, including an enormous number of media files) and FTPed it to us and is no longer answering phone calls/supporting it in any way. There's no solution file, no project files, just code.
So I created an empty project locally and moved it to a network path and moved their code inside it because I don't even have enough space to host it locally. Their architecture is suspect, but I need to get it back up and running ASAP so I don't have time to reconsider that at the moment. I opened the project I created, selected "show all files" and attempted to include all of the paths (both media files and code paths) and the application hung. One of the media folders has something like 65,000 files in it. Do I even need to include this?
Regardless, it seems like doing "Include in Project" is taking forever, I've spent hours wrestling with it, trying to do one folder at a time...but often it's just hanging and I have to kill the process. Is there a faster way to deal with this? I tried editing the project file directly but including this media folder made the solution take absolutely forever to load.
Any general suggestions on how to approach this situation?
as long there is no direct reference you don't need to include media files into the project.
I bet those files are just loaded runtime from a procedure. To make sure make a full search for the media folder in the sources.
Imho get just the files to a local store, create a solution, and then add all resources and sources. If needed you can copy the media files later again into the project.
I had the same problem with local files. I probably killed VS2010 three times since it would always seem to lock up. I then recreated the folder structure, but not with the correct name, then save the project, open it with a text editor and change the names to the actual structure. Finally use "Add > Existing Item". It's still slow, but a bit faster.
It's not hanging - if you leave it long enough it will finish. Know what you mean though - it took half a day to include dojo on one of my projects.
You may want to try SharpDevelop to include large folders into your projects - it seems much, much faster than visual studio when given this task. You can then just re-open the project in vs. Hope this helps.
In an earlier question, I've found out that sadly Solution Folders are not real folders inside a directory.
I wonder if there is an AddOn or Macro that adds this functionality? i.e. when I create a Solution Folder, it created a real folder. When I Create a new Item (Right Click => Add => New Item) it automatically moves them into that folder, removing causes it to delete it from disk (after asking) etc.
This is for Visual Studio 2005, although we might upgrade to 2008 in a few months.
As of now, this doesn't seem to be possible in either VS 2005, 2008 and 2010 and there is no AddIn for this.
I too thought it was a strange idea. However it can be a useful tool to logically group projects in solutions without necessarily moving around folders in the file system.
I suspect you need this for revision control tool. In that case Look at AnkhSVN.
Maybe what you want is to add files to a solution folder as «links», i.e., keeping the files where they are but giving them a different organization inside the solution.
(when you add an existing file to a solution folder or to a normal project folder, if it is in a different corresponding physical folder, the file is copied).
It usually stays unnoticed, an option in the «Add > Existing Item ...» dialog where you can choose "Add As Link", instead of the "Add".
This allows to share files amongst projects, or, simply, organize them differently.
What I oftem miss is the possibility to add "virtual" folders inside a project, for organizational purposes, without breaking the namespace/folder best-practice.
Can't really get the point you want to add this function.
Sometimes you want to know if it can do this , however, the answer may be no. But it is not necessary means you can't achieve your original goal, there still a few ways to work around it without this.
Additionally, VS solution suppose to be the shortcut of your project settings and should not been included in any hard-code, the solutions may be various between the PCs and IDE envrionment.
I didn't really use VS2005 much, but have been using VS2008 for the past year.
It has a tick box for creating a solution folder when you create a new solution/project.
If you then use the "Solution Explorer" window you can create and manipulate folders and class files within them. This will actually create new directories that match.
Deletion of files from within the Solution Explorer will also delete the actual files from disk.
I have experienced an annoying issue with Visual Studio 2005... sometimes when I rebuild, and even if I do a Rebuild Solution, it will come back with no errors or warnings, but then when I later edit another code file, even without changing it, and rebuild, it will find an error or warning in that other file. Clearly, the earlier Rebuild Solution did not recompile that file! How can I force VS to completely recompile every file?
I've seen this happen before when you have multiple projects in your solution and the references get mixed up.
Say you have four projects in your solution, Common, Business, Data, and UI. Assume that Common is referenced by the other three projects.
What we want is for Common to be a "project reference" from the other three projects - they'll then pick up their copy from the build output directory of Common.
But, sometimes, one of the projects will get it's reference mixed up. Say, in this case, that UI starts referencing the copy of Common in the build output directory of Data. Now, any change that compiles "UI" without also compiling "Data" will result in two, possibly incompatible, versions of "Common" being a dependency of UI.
Another scenario is where the reference is to a binary, such as from a "lib" directory. Then, one of the projects ends up referring to a build output location instead of lib.
I don't know what causes this - but I see it all the time, unfortunately.
The fix is to go through the references of each project and find the one (or more) that point to the wrong place.
It might help to clean the solution prior to rebuilding -- right click on the solution in the Solution Explorer and choose "clean solution" -- this deletes temporary files and is supposed to clear out the bin and obj folders, so everything is rebuilt.
I'm with Guy Starbuck here, but would add that Rebuild Solution is supposed to do a Clean Solution followed by Build Solution, which should, then, have solved your issue to begin with. But VS 2005 can be terrible in this regard. Sometimes it just starts working after several rebuilds. If upgrading to 2008 isn't an option, consider manually clearing the bin folder.
Is this related to the Configuration Manager? There you can select which projects in your solution build. Not sure if this helps.
Depending on the types of warnings it is not possible if I recall correctly.
For example, warning messages for XHTML compliance are ONLY displayed when the file is open. You might check the tolerance settings inside VS to see if you can change it.
This sounds strange - Rebuild should build everything regardless of changes and Build should only build things that have changed.
The behaviour you've described should only happen if you have modified something that is referenced by the unchanged file so that it is now incorrect.
I'm trying to build a small VS 2005 solution I've just checked out of source control, and I'm getting this easy to understand error:
...\AssemblyInfo.cs' could not be
opened ('The system cannot find the
file specified. ') (The file is fairly
obviously missing)
Because this file's automatically generated, I've never paid it much heed before, and in VS 2003 (which I still work with day to day - pity me) it never seems to matter if it's missing.
So 2 questions:
1. How can I get VS 2005 to regenerate the file.
2. Could anyone explain to me in a couple of sentences what the assembly info file is all about, why it's generated, why it's a good idea to have an automatically generated file critical to my solution building etc etc.
Thanks - Andrew.
Edit: OK, I've googling some more, and it's probably significant that this is in an Nunit Test Project.
Update: Deleting the reference in solution explorer an Alex suggested did the trick, and the project now builds, but I'm not entirely happy with that as a solution. If the file is so unimportant, why is it generated in the first place? And if the file does perform a vital task, what am I missing out on by just deleting it?
Also, is it even possible to get it back? Either by getting VS to regenerate it, or by manually hacking one up (possibly using another as a template)?
This file contains assembly-wide settings like assembly version, name, etc. It is automatically generated when you change those settings using properties pages of the project. You should have this file in the project with sort of transparent icon (I think it is in resource folder or something like this by default). Locate it in the project tree and delete it. Visual studio will stop looking for it during build.
PS: assuming the path starts with .. and not ... then this file should be located one folder up from the project in the source control. So you can try looking there.