Skip to content

Instantly share code, notes, and snippets.

@roozbehid
roozbehid / create_wix_in_csproj.csproj
Last active July 15, 2024 21:07
MSBuild, csproj hack to auto generate wxs file for wix for general dependencies like Microsoft dlls and such
<!--
I found this way somethimes saves you good chunk of time
-->
<Target Name="Createwxs" AfterTargets="AfterBuild">
<ItemGroup>
<MicrosoftDlls Include="$(OutputPath)\Microsoft.*.*" />
<MicrosoftDlls Include="$(OutputPath)\System.*.*" />
@roozbehid
roozbehid / reference_dependency.csproj
Last active July 15, 2024 21:01
MSBuild hack to copy output of a reference project into output. Reference project can be from other language like c++
<!--
I find myself using this a lot to coordinate incompatible reference types. but still project dependencies.
Example 1. CSProj project referencing a C++ project which also brings some other native dependencies
Example 2. .net core project running another project as .net48 executable, but referencing directly causes so much dll hell due to incompatibility of frameworks.
This way you can put them in correct folder location
-->
<Target Name="CopyPublishedFiles" AfterTargets="BeforeBuild">
@roozbehid
roozbehid / build_and_publish.csproj
Created July 15, 2024 20:56
Msbuild hack to publish your project while building it
<Target Name="PublishAfterBuild" AfterTargets="Build" Condition="'$(PublishCallWithinBuild)' != 'true' ">
<MSBuild Projects="$(MSBuildThisFileFullPath)" Targets="Publish" Properties="PublishCallWithinBuild=true" />
</Target>