79271307

Date: 2024-12-11 10:23:02
Score: 1
Natty:
Report link

Thank to Guru Stron. dotnet build is a command which I need. I have created csproj file in a dir where there is my cs.file. I named this dir TestScript.

TestScript.csproj file

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
  </ItemGroup>

</Project>

Program.cs file

Process process = new Process();
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.FileName = @"C:\Program Files\dotnet\dotnet.exe";
process.StartInfo.Arguments = @"build TestScript\TestScript.csproj -t:Build";
process.Start();
process.WaitForExit();
Process.Start(@"TestScript\bin\Debug\net9.0\TestScript.exe");
Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Adrian Przemysław Drozdowski