Skip to content

Instantly share code, notes, and snippets.

View xavierdecoster's full-sized avatar

Xavier Decoster xavierdecoster

View GitHub Profile
@xavierdecoster
xavierdecoster / CSharpRemoveRegionRewriter.cs
Last active July 28, 2020 09:04
Roslyn - SyntaxRewriter to remove region directives
public class CSharpRemoveRegionRewriter : SyntaxRewriter
{
public CSharpRemoveRegionRewriter()
: base(true)
{
}
public override SyntaxNode VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node)
{
return Syntax.SkippedTokensTrivia();
@xavierdecoster
xavierdecoster / gist:4529586
Created January 14, 2013 11:53
My way of dealing with TFS Binaries folder... Simply call the following MSBuild task anywhere you want it to be executed :) <DisplayBinariesFolder RootFolder="C:\a\bin"/>
<UsingTask TaskName="DisplayBinariesFolder" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<RootFolder ParameterType="System.String" Required="true"/>
</ParameterGroup>
<Task>
<Reference Include="System.Core"/>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Using Namespace="Microsoft.Build.Framework"/>
<Using Namespace="Microsoft.Build.Utilities"/>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
<ModifiedSolutionDir>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</ModifiedSolutionDir>
<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
<!-- Property that enables building a package from a project -->
@xavierdecoster
xavierdecoster / register a myget feed.markdown
Last active July 12, 2022 12:43
Store MyGet credentials in your roaming user profile NuGet.config

Execute the following script using your MyGet [feedUrl] and MyGet [username] , [password] and [apikey]. Run this from a commandline where you have access to nuget.exe (or set the path to your nuget.exe in a system environment variable).

Store credentials in machine-level nuget.config (non-transferable)

nuget setapikey [apikey] -source [feedUrl]
nuget sources add|update -Name [name] -source [feedUrl] -User [username] -pass [password]
@xavierdecoster
xavierdecoster / nuspec-readme
Created May 6, 2012 13:39
Readme file for NuSpec v1.2.0
# NuSpec
Simply run Install-Package NuSpec (once for the solution, doesn't matter which project) to get a set of extra cmdlets available in the NuGet Package Manager Console.
The cmdlets in this package rely on the NuGet "Enable Package Restore" feature, which adds a .nuget folder in the solution directory containing the nuget.exe command line tool and nuget.targets MSBuild file.
Available cmdlets: *Install-NuSpec*, *Enable-PackagePush*
## Creating the package and auto-build
Install-NuSpec <ProjectName> [-EnablePackageBuild]
@xavierdecoster
xavierdecoster / updateAllNuGetPackagesInSolution
Created March 22, 2012 09:19
Update all packages in a solution from the NuGet Package Manager Console
Get-Project -All | % { Get-Package -ProjectName $_.ProjectName | Update-Package -ProjectName $_.ProjectName}
@xavierdecoster
xavierdecoster / Online NuGet cache
Created March 9, 2012 15:52
How to quickly create an online NuGet cache
cd $env:LOCALAPPDATA\NuGet\Cache
get-childitem . *.nupkg | % { nuget push $_ -ApiKey 9cbe3269-0e8d-4f86-a9ce-356309641b40 -Source http://www.myget.org/F/onlinecache/api/v2/package }