Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Friday, 12 August 2016

Problems installing Microsoft .Net Core 1.0.0 VS 2015 Tooling Preview 2

Problem

I had a funky installation of Visual Studio. Everything seemed to be working but when I came to install the Microsoft .Net Core 1.0.0 VS 2015 Tooling it refused to install:

core-001

Repeated attempts to repair or reinstall Visual Studio 2015 Enterprise just wasn’t getting anywhere and I wasn’t in a position to flatten the machine and start again. What was I to do?

Solution

I managed to run the installer and force it not to check Visual Studio using a command line switch:

ukafr02@UKSTOL0079 C:\Users\ukafr02\Downloads
$ DotNetCore.1.0.0-VS2015Tools.Preview2.exe SKIP_VSU_CHECK=1

core-002

core-003

core-004

Happy days!

Monday, 28 March 2016

Files still read-only when refactoring using ReSharper

Problem

ReSharper refactoring operations fail in Visual Studio with the message:

Refactoring Failed

Files still read-only:

Here is an example:

image

This occured with ReSharper Ultimate v10.0.2 and Visual Studio Community Edition 2013 (Version 12.0.300101.00) and the .

Solution

In Visual Studio go to Tools > Options > Source Control > Plug-in Selection and set the source control plug-in to None.

image

Saturday, 12 January 2013

ReSharper plugins folder on Windows 7

Here’s a quick reminder that applies to ReSharper 5.1 in Visual Studio 2010 on Windows 7.

ReSharper plugins on Windows 7 live in the following location:

C:\Users\<User Name Here>\AppData\Roaming\JetBrains\ReSharper\v5.1\vs10.0\Plugins\

Thursday, 1 March 2012

Specifying x86 at the solution level and in CruiseControl.Net

On my latest project I have to ensure all the projects in a solution are built using the x86 platform. To ensure this works as expected I needed to use the Configuration Manager in Visual Studio 2010. I also needed to ensure the solution built correctly in CruiseControl.Net.

Visual Studio Configuration Manager

The configuration manager can be found is 2 ways:

  1. Go to Build > Configuration Manager…
  2. Right-click on the solution in the Solution Explorer and select Properties from the context menu. Click the Configuration Manager… button in the solution property pages dialog.

Once the configuration manager has opened you can change the build configuration for the entire solution. Here’s an example before making changes to the build configuration:

Untitled

You can now select the appropriate build configuration and platform for each project in the solution. If you change the Active solution platform you may find that the Build check boxes are all unticked. Don’t forget to tick them if you want the projects to build (note that you can get caught out here; if these check boxes are cleared and you subsequently try to Clean or Build at the solution level nothing will happen).

 Untitled1

Sometimes the x86 option is not available in the Platform dropdown next to each project. To create it select the <New…> option and in the resulting New Project Platform dialog box do the following:

  1. Select x86 under New platform:
  2. Under Copy setting from: choose Any CPU
  3. Deselect Create new solution platforms
  4. Click OK

Untitled2

CruiseControl.Net configuration

To modify the CruiseControl.Net project configuration change the MsBuild task as follows:

<msbuild>
    <executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
    <workingDirectory>C:\<your>\<working>\<directory></workingDirectory>
    <projectFile>Your.Solution.File.Name.sln</projectFile>
    <timeout>600</timeout>
    <buildArgs>/p:Configuration=Release /p:Platform=x86</buildArgs>
    <logger>ThoughtWorks.CruiseControl.MsBuild.XmlLogger,C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>

Note line 6 where we specify the configuration and the platform.

Wednesday, 28 September 2011

Open XAML file in XAML view by default in VS 2010

When working with XAML in Visual Studio 2010 I prefer to see XAML as text rather than in the design or split views. To set this as a default in Visual Studio 2010:

  1. Open Visual Studio 2010.
  2. Go to Tools > Options > Text Editor > XAML > Miscellaneous.
  3. Check “Always open documents in full XAML view”.
  4. Click OK.
  5. Job done.

 

Untitled

Tuesday, 19 April 2011

NuGet package manager error

I just got bitten by a known issue with NuGet when Reflector is added to Visual Studio 2010 as an add-in. When the package manager console was opened the following error appeared:

The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\system32\WindowsPowerShell\v1.0\types.ps1xml(2943) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type".
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\system32\WindowsPowerShell\v1.0\types.ps1xml(2950) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type".
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\system32\WindowsPowerShell\v1.0\types.ps1xml(2957) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type".
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\system32\WindowsPowerShell\v1.0\types.ps1xml(2964) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type".
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\system32\WindowsPowerShell\v1.0\types.ps1xml(2971) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type".
System.Management.Automation.CmdletInvocationException: Could not load file or assembly 'Scripts\nuget.psm1' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) ---> System.IO.FileLoadException: Could not load file or assembly 'Scripts\nuget.psm1' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) ---> System.ArgumentException: Illegal characters in path.
   at System.IO.Path.CheckInvalidPathChars(String path)
   at System.IO.Path.Combine(String path1, String path2)
   at Microsoft.VisualStudio.Platform.VsAppDomainManager.<AssemblyPaths>d__1.MoveNext()
   at Microsoft.VisualStudio.Platform.VsAppDomainManager.InnerResolveHandler(String name)
   at Microsoft.VisualStudio.Platform.VsAppDomainManager.ResolveHandler(Object sender, ResolveEventArgs args)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
   --- End of inner exception stack trace ---
   at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadBinaryModule(Boolean trySnapInName, String moduleName, String fileName, Assembly assemblyToLoad, String moduleBase, SessionState ss, String prefix, Boolean loadTypes, Boolean loadFormats, Boolean& found)
   at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleNamedInManifest(String moduleName, String moduleBase, Boolean searchModulePath, String prefix, SessionState ss, Boolean loadTypesFiles, Boolean loadFormatFiles, Boolean& found)
   at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(ExternalScriptInfo scriptInfo, ManifestProcessingFlags manifestProcessingFlags, Version version)
   at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(String fileName, String moduleBase, String prefix, SessionState ss, Boolean& found)
   at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
   at System.Management.Automation.Cmdlet.DoProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.Runspaces.Pipeline.Invoke()
   at NuGetConsole.Host.PowerShell.Implementation.PowerShellHost.Invoke(String command, Object input, Boolean outputResults)
   at NuGetConsole.Host.PowerShell.Implementation.PowerShellHostExtensions.ImportModule(PowerShellHost host, String modulePath)
   at NuGetConsole.Host.PowerShell.Implementation.PowerShellHost.LoadStartupScripts()
   at NuGetConsole.Host.PowerShell.Implementation.PowerShellHost.Initialize()
   at NuGetConsole.Implementation.Console.ConsoleDispatcher.Start()
   at NuGetConsole.Implementation.PowerConsoleToolWindow.MoveFocus(FrameworkElement consolePane)

Basically this error is fixed by removing Reflector as an add-in. Go to Tools > Add-in Manager and uncheck the Startup checkbox next to the .Net Reflector entry and restart Visual Studio.

Image1

Thursday, 23 September 2010

Missing “Edit WCF Configuration” menu option

Sometimes when you have created a new WCF service the “Edit WCF Configuration” context menu option is not available when you right-click on the config file (e.g. app.config). I have reproduced the problem below by creating a new class library and adding a WCF service to it. Right-clicking on the app.config file does not show the “Edit WCF Configuration” option.

Image1

To restore the missing option go to Tools > WCF Service Configuration Editor. This opens the editor but does not open the appropriate configuration file.

Image2

Close the editor immediately. Right-clicking on the configuration file will now show the previously missing “Edit WCF Configuration” option.

Image3

Sunday, 18 July 2010

Visual Studio 2010 keyboard shortcuts

Here are a bunch of keyboard shortcuts for Visual Studio 2010 that I find useful but keep forgetting.

Code completion

Ctrl + Period (.) - Expands the Smart Tag Menu (e.g. to add a ‘using’ statement).
Tab - Inserts expanded code snippet using a shortcut (for example type ‘class’ and hit Tab twice)
Ctrl + Space - Completes the current word in the completion list

Building, running and debugging

Ctrl + Shift + B - Build the solution (also try F6)
F5 - Start the application with Debugging
Ctrl + F5 - Start the application without Debugging
F9 - Sets or Removes a breakpoint at the current line

Navigation

Ctrl + ] - Moves the cursor to the matching brace in the source file
Ctrl + Hyphen (-) - Moves cursor to its previous position
Ctrl + Shift + Hyphen (-) - Moves cursor to the next browsed line of code
Shift + F7 - Switch between the Design and Source View of the document
Ctrl + Shift + F - Displays the ‘Find in Files’ tab of the ‘Find and Replace’ dialog box
Shift + F12 - Displays a list of all references for the symbol selected
Ctrl + / - Moves focus to the Find/Command box

Windows

Shift + Alt + Enter - Toggle Full Screen Mode
Ctrl + M + O - Collapses all Regions to provide a high level overview of the types and members in the source file
Ctrl + M + L - Toggles all previously collapsed Regions
Shift + Esc - Closes the current Tool Window with focus

Other shortcuts

Ctrl + Alt + L - Show Solution Explorer
Ctrl + Shift + A - Displays the Add New Item dialog box
Alt + Shift + A - Displays the Add Existing Item dialog box

Wednesday, 3 February 2010

Track active items in Solution Explorer

When opening a source file in Visual Studio, if you want the solution explorer to reflect the location of the file ensure the appropriate option is set:

Tools > Options > Projects & Solutions > General

Set the Track Active Items in Solution Explorer option.

Alternatively if you’ve got ReSharper use Ctrl-Shift-T.

Monday, 19 October 2009

ExpressionTreeVisulaizer in VS 2008

To install the ExpressionTreeVisualizer:
  1. Get the C# language samples that include example LINQ projects from http://code.msdn.microsoft.com/csharpsamples.
  2. Open and build the ExpressionTreeVisualizer solution.
  3. Copy the generated ExpressionTreeVisualizer.dll file into ..\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers directory.
If and when you set a breakpoint and hover over an Expression you can click on the magnifying glass icon in the pop-up tooltip to access the Expression Visualizer.