Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 508ad89

Browse files
committed
Enable VB for dotnet cli 1.1
1 parent 12f4ab5 commit 508ad89

File tree

5 files changed

+39
-8
lines changed

5 files changed

+39
-8
lines changed

build/Microsoft.DotNet.Cli.Compile.targets

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,6 @@
240240
<Copy SourceFiles="@(MSBuildTargetsToCopy)"
241241
DestinationFiles="@(MSBuildTargetsToCopy->'$(SdkOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
242242

243-
<ItemGroup>
244-
<FilesToClean Include="$(StageDirectory)/sdk/**/vbc.exe" />
245-
</ItemGroup>
246-
247-
<Delete Files="@(FilesToClean)" />
248-
249243
<ItemGroup>
250244
<FilesToCopy Include="$(StageDirectory)/**/*" />
251245
<PdbsToClean Include="$(StageDirectory)/sdk/**/*.pdb" />

src/dotnet/commands/dotnet-msbuild/MSBuildForwardingApp.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class MSBuildForwardingApp
2727
{
2828
{ "MSBuildExtensionsPath", AppContext.BaseDirectory },
2929
{ "CscToolExe", GetRunCscPath() },
30+
{ "VbcToolExe", GetRunVbcPath() },
3031
{ "MSBuildSDKsPath", GetMSBuildSDKsPath() }
3132
};
3233

@@ -111,5 +112,11 @@ private static string GetRunCscPath()
111112
var scriptExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".cmd" : ".sh";
112113
return Path.Combine(AppContext.BaseDirectory, "Roslyn", $"RunCsc{scriptExtension}");
113114
}
115+
116+
private static string GetRunVbcPath()
117+
{
118+
var scriptExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".cmd" : ".sh";
119+
return Path.Combine(AppContext.BaseDirectory, "Roslyn", $"RunVbc{scriptExtension}");
120+
}
114121
}
115122
}

src/tool_roslyn/RunVbc.cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
3+
REM Copyright (c) .NET Foundation and contributors. All rights reserved.
4+
REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
5+
6+
"%~dp0..\..\..\dotnet" "%~dp0vbc.exe" %*

src/tool_roslyn/RunVbc.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) .NET Foundation and contributors. All rights reserved.
4+
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
5+
#
6+
7+
set -e
8+
9+
SOURCE="${BASH_SOURCE[0]}"
10+
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
11+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
12+
SOURCE="$(readlink "$SOURCE")"
13+
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
14+
done
15+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
16+
17+
"$DIR/../../../dotnet" "$DIR/vbc.exe" "$@"

src/tool_roslyn/tool_roslyn.csproj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19-
<Content Include="RunCsc.sh;RunCsc.cmd">
19+
<Content Include="RunCsc.sh;RunCsc.cmd;RunVbc.sh;RunVbc.cmd">
2020
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2121
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
2222
</Content>
@@ -33,7 +33,7 @@
3333
DestinationFiles="@(HackFilesToCopy->'$(PublishDir)/%(RecursiveDir)%(Filename)%(Extension)')" />
3434
</Target>
3535

36-
<Target Name="MakeCscRunnableAndMoveToPublishDir"
36+
<Target Name="MakeCscAndVbcRunnableAndMoveToPublishDir"
3737
AfterTargets="Publish"
3838
BeforeTargets="RemoveFilesAfterPublish">
3939
<ItemGroup>
@@ -55,6 +55,13 @@
5555
DestinationFiles="$(PublishDir)/csc.exe;
5656
$(PublishDir)/csc.runtimeconfig.json;
5757
$(PublishDir)/csc.deps.json;" />
58+
59+
<Copy SourceFiles="$(PublishDir)/runtimes/any/native/vbc.dll;
60+
$(PublishDir)/$(TargetName).runtimeconfig.json;
61+
$(PublishDir)/$(TargetName).deps.json;"
62+
DestinationFiles="$(PublishDir)/vbc.exe;
63+
$(PublishDir)/vbc.runtimeconfig.json;
64+
$(PublishDir)/vbc.deps.json;" />
5865
</Target>
5966

6067
<Target Name="RemoveFilesAfterPublish"

0 commit comments

Comments
 (0)