Visual Studio copy/paste into Outlook with standard formatting? - visual-studio

I have custom settings in Visual Studio that include a dark background. Copy/pasting to Outlook produces a crime against eyeballs with a dark background in code on a white background of the mail.
Does anyone have any ideas of how I can paste code in standard VS formatting (NOT unformatted text from paste special, and not paste with my custom VS formatting)?
(Alternatively, does anyone know a quick way to switch between themes in VS? Thinking that could also work...)

The following blog post details how to address this issue in VS2012:
http://codinglifestyle.wordpress.com/2013/05/17/copy-and-paste-formatting-with-visual-studios-dark-theme/

Ok so the closest I got was using CopySourceAsHtml which also allows you to define custom css styles for that copied html. I peeked at the css styles when copying code from the default VS theme and copied them over.
Got me 90% there which is good enough - no black code backgrounds on white email backgrounds!

This free VS Extension (named "Copy As HTML") allows you to choose the background color when copying to clipboard:
This is a lightweight tool that allows you to copy code from the Code
Window and convert it into HTML while preserving syntax highlighting,
indentation and background colour.

This add-in adds a command to copy in plain text: VSHelper

Related

In Visual Studio2019 how to setup the codehighlightcolors in the editor for Classes/Parameter/Functions etc.?

I watched a youtube video about Blazor and noticed that my color highlighting of my code in the texteditor was different from the video. In the video much more codebits had different colors then it is the case in my Visual Studio 2019 setup.
My code has some coloring but its alot of white lines instead of every codebit differend colorsetting (Class/Function/Parameter/...).
Please see the attached jpeg!
How can I also have those color settings from the video (jpeg left side is what I want // right side is what I have) in my VS? Is that a "plugin" to download or where can I find the settings for that?
In VS I checked Tools-Options- and then tried different dropdown menues but could not find the place for these settings (kind of lost because there are so much options)!
Thanks for helping me to get more colors in my code/life :)
Don't know if that is totaly the same thing I saw but it it close to what I wanted.
You can install a Extension to VS via Marketplace. I installed this:
Enhanced Syntax Highlighting
From Stanislav Kuzmich

How to locate style in Less file

I have noticed that web essentials for visual studio creates a .css.map file when compiling less. Does this mean it is possible to navigate from a selector in the css file back to the selector in the associated less file? If so how?
Yes, the idea of source maps is to map code or css from a compressed file back to the original uncompressed version.
Here is a good guide to using source maps in Chrome and Firefox.
An introduction to source maps
In VS 2013, if you enable LESS preview window, you can leverage Go To Definition command on a selector in preview to highlight the corresponding selector in LESS source. (via right-click context menu or press F12 in preview window -- see #809). When applicable, it will also load the #imported document, where the source is available.
On that note, there are precession issues with libsass' source-map. For that matter, it doesn't work well in SCSS editor.

Styles - Visual Studio code fragment, copy & paste Outlook (HTML) - retain styling?

I'm a fan of the Son of Obsidian Visual Studio style (white/color letters on dark-gray background).
It's also great that Outlook attempts to retain syntax highlighting, however I use the white default background in Outlook. The result is that I need to either strip all syntax highlighting on code fragments I email to coworkers, or set the background color of the email darker.
I've tried out the Copy As HTML plugin, however this didn't override the background color for the code fragment in Outlook.
Has anyone figured out a good solution for this kind of workflow?
Hello this is really a late reply :
I use the same theme.
You can refer to this article for the general steps.
http://codinglifestyle.wordpress.com/2013/05/17/copy-and-paste-formatting-with-visual-studios-dark-theme/
The article though tells how to do the opposite of what we want so instead i came out with this :
<style type=”text/css”>pre{background:#344042 !important}</style><pre>
and this does pretty much the job.

Embed image in code with Visual Studio

I remember reading once that there was a way to embed an image into a code file (e.g. a screenshot or diagram) in Visual Studio, but now I can't find any reference to that feature.
Is this possible to do, or am I imagining things?
EDIT: I don't mean embed the image in the executable, for use at runtime. I mean link or embed it literally in the code, for use by developers.
There is a plug-in for VS 2010 that can do this:
Plug-in
There is also a plugin for VS2012 and VS2013. At this moment installing for VS2013 does not seem to work for me though.
ImageComments extension on GitHub
You can embed images in your binary through the use of the ImageList control, which is typically used to store small icons for list controls, gridviews, etc., but could also be used for storing really any image for any purpose. A better solution would be to include a resource file and store your images there.

Visual Studio Blog

I want to write a blog and some of the blogs that I've seen on the Internet have code snippets in VB.NET or C# that look like the text in Visual Studio itself even with the colors.
Is there some sort of application or tool I can use to create code snippets that look like those other blogs.
google-code-prettify is a good one.
Also, SyntaxHighlighter looks great, but I haven't tried it myself. It has explicit support for VB.NET.
If you're using Windows Live Writer for a blog editor I recomend using "Paste from Visual Studio" (link). It's a great way of getting formatted code into your blog posts.
I use this site to convert my code to HTML-formatted text for my blog. Works nicely.
If you don't mind using another application, Notepad++ exports your files to HTML.
Just open your *.cs files and go to Plugins > NppExport > Export to HTML. Fonts and colors are preserved, as defined in your Notepad++ configuration.
FYI, Notepad++ exports to HTML 4.01

Resources