dotnet
async/await in dotnet
- Best Practices in Asynchronous Programming by Stephen Cleary
- C# Under the hood: async/await by Marko Papic
xml transforms in non-web projects using msbuild
Adding XML transforms to non-Web projects (Console, Winforms, WPF etc.)
- Add Debug/Release versions of confit as XDT transforms
- Add
MSBuild.Microsoft.VisualStudio.Web.targetsnugetPackageReference Importtargets (conditionally or it won’t load the first time)- Add
TransformXmltoAfterBuild
xml<Project> ... <ItemGroup> <None Include="App.config" /> <None Include="App.Debug.config"> <DependentUpon>App.config</DependentUpon> <SubType>Designer</SubType> </None> <None Include="App.Release.config"> <DependentUpon>App.config</DependentUpon> <SubType>Designer</SubType> </None> </ItemGroup> ... <ItemGroup> <PackageReference Include="MSBuild.Microsoft.VisualStudio.Web.targets"> <Version>14.0.0.3</Version> </PackageReference> </ItemGroup> ... <Import Condition="Exists('$(VSToolsPath)\Web\Microsoft.Web.Publishing.targets')" Project="$(VSToolsPath)\Web\Microsoft.Web.Publishing.targets" /> ... <Target Name="AfterBuild"> <TransformXml Source="@(AppConfigWithTargetPath)" Transform="App.$(Configuration).config" Destination="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')" /> </Target> </Project>
persistkeyset
Installed certificates expiring? Use X509KeyStorageFlags.PersistKeySet - What is the impact of PersistKeySet
certificate validation overriding
csharpServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateCertificate); public static bool ValidateCertificate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; }