Skip to content

Instantly share code, notes, and snippets.

View asklar's full-sized avatar

Alexander Sklar asklar

View GitHub Profile
@asklar
asklar / JustMyXaml.ps1
Created June 1, 2020 08:44
Enables or disables VS2019 "Just my XAML" feature programmatically
# This script enables or disables VS 2019's JustMyXaml feature
[CmdletBinding()]
param([bool]$Enable)
if (!([bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match "S-1-5-32-544"))) {
throw "Please run this script elevated";
}
$instanceId = & "$(${env:ProgramFiles(x86)})\Microsoft Visual Studio\Installer\vswhere.exe" -property instanceId
$hiveFile = "$($env:LocalAppData)\Microsoft\VisualStudio\16.0_$instanceId\privateregistry.bin"
@asklar
asklar / Preprocess.targets
Created May 19, 2020 03:01
Preprocess C++ to file
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Preprocess">
<Message Condition="'$(Source)'!=''" Text="Preprocessing: $(Source)"/>
<Error Condition="'$(Source)'==''" Text="To generate a pre-processed file, please specify a source file with msbuild /p:Source=nameOfTheSource.cpp"/>
<CL PreprocessToFile="true" Sources="$(Source)"
AdditionalIncludeDirectories="%(ClCompile.AdditionalIncludeDirectories)"
PreprocessorDefinitions="%(ClCompile.PreprocessorDefinitions)"
AdditionalOptions="%(ClCompile.AdditionalOptions) /d1PP"
PreprocessKeepComments="true"