Does vscode have a csproj generator?

I am using Visual Studio Code because it is lighter than Visual Studio but still gives me intellisense. However, I couldn't find a way to generate the .csproj or .sln code automatically, so I was making the files from scratch. There is little documentation in it, so I had to abandon the examples from other files. Everything was fine and good, but lately I got stuck where compiling with msbuild does not give me the same result as compiling csc.exe. I would get a BadImageFormatException whenever I load into a dll and try to use one of its classes. My question is, is there a way to get vscode to generate a csproj or sln file when new projects are created? And if it doesn't, is there a way to make the csproj files I compile the same way as with batch files?

Csproj file:

<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Drawing" />
    <Reference Include="Splicer.dll">
        <HintPath>Splicer.dll</HintPath>
    </Reference>
    <Reference Include="DirectShowLib-2005.dll">
        <HintPath>DirectShowLib-2005.dll</HintPath>
    </Reference>
    <Compile Include="src\*.cs" />
</ItemGroup>
<Target Name="Build">
    <MakeDir Directories="$(OutputPath)"
        Condition="!Exists('$(OutputPath)')"
    />
    <Csc
        Platform="x86"
        NoWarn=""
        Sources="@(Compile)"
        OutputAssembly="$(OutputPath)$(AssemblyName).exe"
    />
</Target>
<PropertyGroup>
    <AssemblyName>SplicerDemo</AssemblyName>
    <OutputPath>bin\</OutputPath>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

      

Batch compiler:

@echo off
set "CSC=C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe"
set "Refs=Splicer.dll,DirectShowLib-2005.dll"
set "Files=src\SplicerDemo\*.cs"
set "Compile=%csc% /platform:x86 /r:%Refs% /out:SplicerDemo.exe /t:exe %Files$"
cmd

      

File to compile:

using Splicer.Renderer;
using Splicer.Timeline;

using System.Drawing;

namespace SplicerDemo   {
    public class Start  {
        // Variables
        public string   outputFile;

        public Start()  {
            outputFile= "Foo.avi";
        }

        public static void Main()   {
            Start   s=  new Start();

            System.Console.WriteLine("Starting Build...");
            s.save();
            System.Console.WriteLine("Build Finished!");
        }

        // --- Methods ---

        public void save()  {
            // Variables
            DefaultTimeline timeline=   new DefaultTimeline(24);
            IGroup  _group= timeline.AddVideoGroup(32, 1024, 786);
            ITrack  vtrack= _group.AddTrack();
            ITrack  atrack= timeline.AddAudioGroup().AddTrack();
            Bitmap  img=    new Bitmap("image3.jpg");

            vtrack.AddImage("image1.jpg", 0, 24);
            vtrack.AddImage("image2.jpg", 0, 24);
            vtrack.AddImage(img, 0, 100);
            vtrack.AddImage("image1.jpg", 0, 128);

            atrack.AddAudio("audio1.mp3", 0, vtrack.Duration);

            using(AviFileRenderer renderer= new AviFileRenderer(timeline, outputFile))  {
                renderer.Render();
            }
        }
    }
}

      

+3


source to share


1 answer


Unfortunately VSCode does not have the ability to build / build solutions / projects targeting the full .NET Framework, but it does have support for projects targeting .NET Net. You can use the Yeoman project scaffolding system to create and create projects targeting .NET-Core.



+2


source







All Articles