-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCs.DotnetStub.targets
31 lines (28 loc) · 1.52 KB
/
Cs.DotnetStub.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!-- Creates a stub that launch the main assembly dll with the dotnet utility. -->
<!-- Import this script at the end of a .NET Core project to enable stub creation. -->
<Project>
<Target Name="_CreateDotnetBatchStubInTargetDir" AfterTargets="Build" Condition="$([MSBuild]::IsOsPlatform(Windows))">
<WriteLinesToFile
Condition="!Exists('$(TargetDir)$(TargetName).exe')"
File="$(TargetDir)$(TargetName).bat"
Lines="@pushd %~dp0;@dotnet $(TargetName).dll %*;@popd" Overwrite="true" />
</Target>
<Target Name="_CreateDotnetBatchStubInPublishDir" AfterTargets="Publish" Condition="$([MSBuild]::IsOsPlatform(Windows))">
<WriteLinesToFile
Condition="!Exists('$(PublishDir)$(TargetName).exe')"
File="$(PublishDir)$(TargetName).bat"
Lines="@pushd %~dp0;@dotnet $(TargetName).dll %*;@popd" Overwrite="true" />
</Target>
<Target Name="_CreateDotnetShellScriptStubInTargetDir" AfterTargets="Build" Condition="!$([MSBuild]::IsOsPlatform(Windows))">
<WriteLinesToFile
Condition="!Exists('$(TargetDir)$(TargetName)')"
File="$(TargetDir)$(TargetName)"
Lines="cd `dirname $0`;dotnet $(TargetName).dll $@;cd -" Overwrite="true" />
</Target>
<Target Name="_CreateDotnetShellScriptStubInPublishDir" AfterTargets="Publish" Condition="!$([MSBuild]::IsOsPlatform(Windows))">
<WriteLinesToFile
Condition="!Exists('$(PublishDir)$(TargetName)')"
File="$(PublishDir)$(TargetName)"
Lines="cd `dirname $0`;dotnet $(TargetName).dll $@;cd -" Overwrite="true" />
</Target>
</Project>