How can I force Visual Studio to trust all projects in a solution? - visual-studio

I have a solution for Orchard CMS, which, when I first opened it, prompted me asking whether to trust projects from an external source. I unchecked the box for "Ask for every project in the solution", and it opened fine. Now, I used a code generation tool to add a project to the solution while it was open. VS then detected a change, and prompted me to reload the solution. After reloading, I see most - save 1 or 2 out of a great many - projects failed to load. When I click on an individual project and reload that, I get asked whether I trust it again. When I click OK, the project loads fine. Only issue is I don't want to go and manually reload every project. I tried closing the solution and opening it again, but then most projects still fail to load.

You can reload multiple projects at once: simply select multiple projects in the Solution Explorer (e.g. via Ctrl+Click or Shift+Click), right-click the selection, and choose Reload Project.

I fixed this type of issue by following these instructions from the Visual Studio documentation.
Configure trust settings for files and folders
Basically:
Open Tools > Options > Trust Settings and select the Configure Trust Settings link in the right-hand pane.
Click Add in the Trust Settings dialog, and then select File or Folder.
Navigate to and select the file or folder you want to add to the trusted list.

Related

Visual Studio 2013: auto-refresh solution explorer in "show all files" mode

Is there any way or some unobvious workaround to make the Solution Explorer refresh automatically (in Show All Files mode) when there are changes to the project directory tree? Currently if I rebuild a project with different output settings (which would add some files and remove some others), no changes would get reflected in Solution Explorer until I manually click refresh button. Doesn't seem too convenient for a tool aimed at programming, i.e. automating repetitive tasks...
Update
A picture is worth a thousand words:
My relevant options # Tools > Options > Environment > Documents:
Let's assume that Release directory is empty and Show All Files mode enabled
Now, I build my Release config... Build succeeds, but no changes are visible in Solution Explorer:
Only after I hit refresh button manually can I see the results of build process:
So I'm basically asking if there are ways to make Solution Explorer update automatically when changes occur, not to make externally modified files auto-reload in VS editors.
#Sunny Moon - There is no option right now to automatically refresh the project tree if changes are introduced. You have to manually select the Refresh button in the command bar of Solution Explorer. I'm going to track this feedback along with other areas I've been collecting for Solution Explorer so thanks for sharing your frustration here.
Thanks!
Cathy
Visual Studio IDE Team
Just set check the “Auto-load changes, if saved” check box on VS2013 Option menu >> Environment menu.
That was impossible in VS 2013 and 2015, but with 2017 Microsoft did the right thing and revamped the Solution Explorer a bit - now there is clear and logical separation between solution (virtual) and folder (physical) views, and changes to the filesystem are now tracked and displayed automatically.

Browser links are not showing in Visual Studio 2013

I am using Visual Studio 2013. I don't no what happened to VS,now it is not showing Browsers list.How to overcome from this problem please suggest me.
Include screenshot of the project / solution list. I believe somehow you are opening a .csproj project file for a non MVC application even though it has all the code files that look like a MVC application. For instance someone may have created a windows form application and imported all the MVC / .cs files from a MVC ASP .NET project.
If you included that screenshot we could see the icon next to the project to rule that out as a potential cause.
Alternatively you can try reset your visual studio 2013 settings by doing the following:
1.On the Tools menu, click Import and Export Settings.
2.On the Welcome to the Import and Export Settings Wizard page, click Reset all settings and then click Next.
3.If you want to save your current settings combination, click Yes, save my current settings, specify a file name, and then click Next.
—or—
If you want to delete your current settings combination, choose No, just reset settings, overwriting my current settings, and then click Next. This option does not delete default settings, which will still be available the next time you use the wizard.
4.In Which collection of settings do you want to reset to, select a settings collection from the list.
5.Click Finish.

MS Visual Studio.net - saved source files missing after reboot

The other day I created a MS visual studio 2010 C# project and started coding. I saved the source frequently, but I did not select a destination to save to (just pressed ctrl+s and assumed the source was being saved). However I had to run and threw my laptop in my backpack on sleep. Unfortunately this laptop (acer aspire 5252 fyi) battery drains extremely quickly when on sleep, and eventually my computer shut off. Now I can't find my source files anywhere and I'm going crazy because I know I saved it and it's several days worth of work.
I tried doing a windows search but couldn't find the project files. I also did a little experiment - I created a new project and without saving the entire solution, I pressed ctrl+s on the source files. Save was successful, but I cannot even find the file that's open in the IDE. Even the "open containing folder option" is grayed out (see screen shot).
I really need these source files back. Obviously it's because I didn't save the solution that the source got wiped out, but where do the source files get saved temporarily before the solution is saved?
Thanks.
You are using Visual Studio's support for temporary projects. Nice feature for quicky test projects (and SO answers) but not a great way to ensure that your projects are still there after VS quits. Programming without source control is similarly inadvisable.
Tools + Options, Projects and Solutions, General. Ensure that the "Save new projects when created" option is ticked to minimize the odds that you'll forget to pick a solution folder. Triple-check that creating a new project now gives you a "Location" property in the dialog.
There is a default location for projects to be saved. That is probably where your files went.
In Visual Studio, on the menu, click Tools > Options > Projects and Solutions > General. There is a "Visual Studio projects location".
On my Windows 7 machine, the folder for Visual Studio 2010 is
C:\Users\<username>\Documents\Visual Studio 2010\Projects
Your unnamed project is probably saved with a default name like WebSite1.
If you would like to change that default location, here is some information on how to do that.
Visual Studio temporary projects are normally found in *C:\Users\"User Name"\AppData\Local\Temporary Projects* . It is a temporary folder that is deleted as soon as Visual Studio starts up.
How to save a Temporay Project from above link:
To save a temporary project
In Solution Explorer, choose the solution or project that you want to save.
On the menu bar, choose File, Save or Save As.
The Save Project dialog box opens.
In the , Name box, specify a name for the project.
In the Location box, specify where you want to save the project.
Select the Create directory for Solution check box.
Note: This check box is not available for Visual Basic web projects, Visual C# web projects, or other directory-based projects.
In the New Solution Name box, specify a name that differs from the project name.
Select the Add to Source Control check box if you want to add the solution to a version-control database or repository.
Choose the OK button.

Some projects not showing TFS Menus

I have 8 projects in my solution. 3 of them are not showing any TFS menus when I right click on the project or any of the files from Solution Explorer. They are in TFS though, if I go through the Source Control Explorer I can manually check them out/in. Also those 3 projects do not have associated .vspscc which the other 5 projects do. Something must have got messed up but I am not sure what. How can I fix this so that I get those TFS options back in Solution Explorer. Having to manually check out/in is not practical.
edit: I've tried wiping my local copy and bringing the solution down from source control again. I've also removed those projects from the solution and re-added them which did not work.
It sounds like 3 of your projects have lost their source control bindings. You should be able to restore them easily. Just go to the Change Source Control dialog, which will allow you to set the source control bindings for all the projects in your solution:
File > Source Control > Change Source Control...
Then you'll need to enter your TFS server name and the server path for the projects that have lost their bindings.
Edward got me pointed in the right direction, for me it was an issue of TFS having gone offline.
Resolution: I selected the Solution level in Solution explorer, then went into File>Source Control> and selected the Go Online menu option, which restored all of my right click TFS menu options.

How to have TFS 2010 detect changes done to files outside of Visual Studio?

I'm using Team Foundation Server 2010 with Visual Studio 2010.
Whenever I modify a file outside of Visual Studio, TFS doesn't seem to detect the change done to the file, and thus doesn't offer me the option to check-in the file after it has been modified.
How can this be solved?
TFS has a "Reconcile" command for this:
Open the Source Control Explorer
Right-click on the folder with the changes and choose Compare
Select the files you want to reconcile (press CTRL+A to select all files)
Click on the Reconcile button
Set the options in the Reconcile Folder Differences dialog. Make sure Files that do not have pending changes is set to Check Out
Click OK
If you have local changes the Check Out dialog will be shown. Set the preferred Lock type
Click Check Out
See also: Reconcile differences between folders
If you have a network connection to your server while you're working outside of Visual Studio, it's probably best to go ahead and check the file out before editing it, either using the tf command line client, or using the Windows Explorer shell integration that's available in the TFS Power Tools release. (Plus an increasing number of other tools have TFS integration that makes this automatic, but if you're just using notepad, this still needs to be a manual step.)
Of course, there are many times when you're working and you don't have a network connection available that allows you to check out the files.
If you know what files you've modified, you can just check them out from within Visual Studio, then you'll be able to check them back in.
If you don't know what files you've edited, you can detect the changes by running the tfpt online command (also part of the Power Tools release). This will locate the files that have been modified locally and check these files out from the server.
This worked for me, using the TFS Power Tools:
tfpt online /adds /deletes /diff /noprompt /recursive directory-name
(where directory-name is the path to the directory to be updated, otherwise it will detect changes throughout your entire TFS repository)
If you want to know what it would do without it actually making any changes, you can force it to do a dry run by adding the /preview switch.
*1- make changes outside of Visual Studio
2- go to Visual Studio and open Source Control Explorer
3- right click on the folder > "Check Out for Edit" > "Check Out"
4- right click on the same folder > "Undo Pending Changes..." > "Undo changes" > "No to All"*
I tested this workaround on a branch and it helped me a lot. But there are only new files and new folder who has to be done manually.
I recommend to create a branch before the operation. It isolates you the time of the operation.
Note: This technique does also the files identical cleanup that TFS always marks as modified.
Try this. It's some sort of workaround, but it works:
make changes outside of Visual Studio
go to Visual Studio and open Source Control Explorer
right click on the folder > "Check Out for Edit" > "Check Out"
right click on the same folder > "Undo Pending Changes..." > "Undo changes" > "No to All"
That's it. The changes are visible now.
There's also another solution to get TFS to figure out the files that have changed outside of Visual Studio:
Open the solution offline
In Solution Explorer select the solution file and then press the Go Online button ()
TFS will automatically scan the solution for changes after this.
Step one can be achieved in a number of different ways. Here are some:
Use the GoOffline Extension - very simple and effective.
If you're asked for TFS credentials when opening the solution (no automatic domain auth), then don't enter the credentials. The solution will open offline and you'll login after pressing the Go Online button
(extreme solution) Disconnect your network cable; Open the solution; Connect the network cable.
Visual Sourcesafe works like this too and the way I get VSS or TFS to notice the change is by checking the file out once inside Visual Studio.
Open Source Control and go to your TFS folder. Right-click on the folder and choose 'Compare'.
Notice that your edited files show up marked in red.
I find this is better than tfpt online which also gets you files that are not readonly and not edited.
I had this problem in the past, when my Internet was down and I worked offline, and most of my changes didn't appears in Team Explorer.
Following these steps:
First, In the solution explorer, select the folder that you want to re-conciliate (for me, it was my entire solution folder), and select Compare...
Click in Modify Filter, and in the filter text-box, you could type:
*.cs;!obj\;!bin\;!packages\;
In this example, it will include in the search only C# files and exclude in the folders: bin, obj and packages.
Notice the column Pending Change has the info whether the file is marked as edit, add, etc... or nothing...
To mark as edit (when the local item has a matching server item), select the file and choose Check out for Edit...
To mark as add (when the local item doesn't have any server item), select the file and choose Add Files
Finally, I am not sure why the projects are not listed here (after I remove *.cs filter, still doesn't show up), so rebuild the solution to make sure the projects updates as well
+ In the solution, click the connect button (if shows up) that said Go Online.
I found that in Visual Studio 2015, with the project open, Visual Studio discovered for itself that files had been modified externally, and automatically checked them out without me having to do anything. Checking in the project in the normal way saved the external modifications.
In my case, the following worked (at least the one time I tried it):
Go to the Pending Changes panel
Select View Options under either Included or Excluded changes.
Switch between Show All and Show Solution Changes
Switch back if desired
Changing the View Option appears to force a refresh of modified files.

Resources