Created
November 15, 2022 16:53
-
-
Save seclerp/352f6b79817dfb8d3c3afb64dbfbb49b to your computer and use it in GitHub Desktop.
Solution for the task "Run the Java Hello World example via both dotnet run and javac"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>net6.0</TargetFramework> | |
<EnableDefaultCompileItems>false</EnableDefaultCompileItems> | |
</PropertyGroup> | |
<Target Name="GenerateCsharp" BeforeTargets="BeforeBuild" KeepDuplicateOutputs="true"> | |
<WriteLinesToFile File="Program.generated.cs" Overwrite="true" Encoding="Unicode" Lines="$([System.IO.File]::ReadAllText('Program.java').Replace('main','Main').Replace('System.out.println','System.Console.WriteLine'))" /> | |
<ItemGroup> | |
<Compile Include="Program.generated.cs" /> | |
</ItemGroup> | |
</Target> | |
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program { | |
public static void main(String[] args) { | |
System.out.println("Hello, World!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Забув
.Replace('String','string')