Torn
Torn
CC#
Created by Torn on 8/7/2023 in #help
❔ Performance Profiler results blank
12 replies
CC#
Created by Torn on 5/5/2023 in #help
Process.Start fails with 'unterminated quoted string' in Linux
I am trying to run 7z to extract some files. The command seems to work if I just run it from the shell directly, but not from code. Maybe it's not the exact same, and I don't realize it. So I'm doing this:
//Unpack dump with 7z
StringBuilder argument = new($"\"{Config.zipPath}\" x \"{dumpPath}\" -so | \"{Config.zipPath}\" x -y -si -ttar");
foreach (string file in new[] { "vn", "vn_titles" /* and other strings */ }) {
argument.Append($" db/{file} db/{file}.header");
}
Process.Start(Config.shell, string.Format(Config.arguments, argument)).WaitForExit();
//Unpack dump with 7z
StringBuilder argument = new($"\"{Config.zipPath}\" x \"{dumpPath}\" -so | \"{Config.zipPath}\" x -y -si -ttar");
foreach (string file in new[] { "vn", "vn_titles" /* and other strings */ }) {
argument.Append($" db/{file} db/{file}.header");
}
Process.Start(Config.shell, string.Format(Config.arguments, argument)).WaitForExit();
The config file is a list of key=value pairs that get loaded into the static Config class. So, it works for Windows:
shell=cmd.exe
zipPath=C:/Program Files/7-Zip-Zstandard/7z.exe
arguments=/C "{0}"
shell=cmd.exe
zipPath=C:/Program Files/7-Zip-Zstandard/7z.exe
arguments=/C "{0}"
but not for Linux:
shell=ash
zipPath=7z
arguments=-c '{0}'
shell=ash
zipPath=7z
arguments=-c '{0}'
Seems the ash command there fails with an error: x: line 0: syntax error: unterminated quoted string
3 replies
CC#
Created by Torn on 1/22/2023 in #help
❔ How does the application created by PublishSingleFile work?
To be specific,
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
I know the executable contains the apphost, my code as a dll file, and the configuration json files. Will it contain files manually added to the project, like text files, other dll files? What about files from nuget packages? As a separate question, how are these files later retrieved from the single executable? Extracted to some folder? Unpacked into memory?
2 replies
CC#
Created by Torn on 12/26/2022 in #help
❔ Custom template not showing up
I'm trying to create a new custom .csproj template for .NET 7, but I can not seem to get it to show up in the list of templates when creating a new project. The similar one for .NET 6 works fine. I'm not even sure where I could start to resolve this issue. Do either of the included templates show up for you in Visual Studio? Can you spot any problems? The zip files are named 6 and 7, although the inner projects should be named "Default Console Project" and "Native Console Project", respectively.
9 replies
CC#
Created by Torn on 12/18/2022 in #help
❔ Compilation option questions
I am currently reading through different options that can be set inside a .csproj file, as well as overall compilation options, and some of those are confusing to me. 1) For DefineConstants, what does the $(DefineConstants) string mean? 2) What is the difference between a Platform and a PlatformTarget? 3) What is a Win32Manifest, and why would I want to include / not include it (e.g. with the NoWin32Manifest option)? For AoT compilation specifically: 4) Is targetting AnyCPU instead of x64 possible? What would this even do? 5) How do I compile for Linux?
61 replies