bflattened / bflat

C# as you know it but with Go-inspired tooling (small, selfcontained, and native executables)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No auto library specifying

Cubody opened this issue · comments

Why doesn't it automatically include references?

For example,

using System.Security.Cryptography;

I need to specify manually
bflat build --os:windows -r "...\net8.0\System.Security.Cryptography.ProtectedData.dll"

It also ignores auto-generated GlobalUsing.cs

The library doesn't ship with .NET. it comes from nuget. You have to specify it for the same reason you'd have to specify e.g. newtonsoft.json.

I have it from Nuget

using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;

var path = Console.ReadLine();
var decrypted = Encoding.Unicode.GetString(
    ProtectedData.Unprotect(
        File.ReadAllBytes(path),
        null,
        DataProtectionScope.LocalMachine));

var directory = Path.GetDirectoryName(path);

File.WriteAllText(Path.Combine(directory, "UserSettings.decrypted"), decrypted);

image

Oh, nvrm, I see. So I need to specify all libraries I have in a big project?

As I know dotnet generates cache of nuget libraries with path to it. Maybe it's possible to automate it?

bflat is just a compiler. You can orchestrate nuget (even downloads from nuget) with separate tools. For example, MSBuild, or even nuget.exe. bflat is not a build system, you have to bring your own build system. There are many to choose from (GNU Make, MSBuild, ninja, bazel, etc., or just use a shell script).

I see, thank you. What about auto generated files?

I know that this is not supported yet, maybe you can advise how I can specify the generated files myself, but with the addition of a recursive scan of the base files from the project. I would like not to specify the entire project.

I found how to do it ;d
And it works with System.Text.Json

<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>

u may try my small tool bflatA(https://github.com/xiaoyuvax/bflata) which scans the .csproj for dependency and build .rsp building script for ur project.