I am (CURSED! CURSED! CURSED!) writing a batch file.
I want to prematurely exit the batch file with a success code.
This page https://ss64.com/nt/exit.html
claims the way you do this is to type "exit". Quote: "When used in a batch script, this option will exit only the script (or subroutine) but not CMD.EXE. If executed on the command-line it will close CMD.exe"
I execute my batch script on the command line like .\build.bat. It reaches the line "exit". My CMD.exe terminal closes.
We have a ProjectName.csproj with a <PropertyGroup><OutputType>Exe</OutputType></PropertyGroup>. Running at the command line, we can successfully run it with dotnet run on Mac, Linux and Windows. On Mac, we can open it in VS Code, hit "Run", and it runs.
On Windows in VS Code only, if we open it and click the run button, it builds a .DLL instead of a .EXE as its final build output and then fails with a message that you cannot run a .DLL.
Hmm, somewhat to our surprise, we're realizing if we do a git clean -xffd and then do a dotnet build from the command line, at least on Windows, it creates both a ProjectName.dll and a ProjectName.exe.
So it appears the issue in vscode is not that it is building the wrong thing, but that vscode is running the wrong thing?
@gsuberland This makes no sense to me! Pre CoreCLR they would just distribute the .exe file and mono or whatever would run the .exe since it's all just PE to begin with and PE to a non-Windows OS is just another file
@gsuberland the thing is it is generating an exe which serves as a wrapper/launcher for the dll, just for some unknown reason vscode has decided to ignore the exe and run the dll. we're currently trying to figure out if this is because we used the "run c# project" template instead of the "Run .net project" template
@gsuberland At the moment, we're not deploying, we're just trying to run in a debugger and VS code is acting weird. we're aware of the difference between dotnet build and dotnet publish.
@whitequark@gsuberland i think you can get around this by running dotnet publish, which transforms what you've already built into a normal double clickable thingy. but i'm not quite sure if i'm right about that.
(This also required a .vscode/tasks.json containing a "build" step, which Mac had not required.)
You'll notice to make it work, we had to make two different build configurations. One is a template vscode spat out on mac, the other is a template vscode spat out on windows. Neither works on the other OS. (1/2)
@jalcine I heard a rumor that he's got ghostwriters but just now I looked it up and found out no, that's not true, whoever told me that heard he's got a team doing continuity/editing and got confused, but what google DID reveal is HE GHOSTWRITES FOR OTHER AUTHORS, THERE ARE MORE BRANDON SANDERSON BOOKS THAN WE THOUGHT THERE WERE wtf
@donni Trucker hats, denying all materialistic logic, made serious attempts to transform themselves into physical copies of him, a grotesque process that produced disturbing firms when it was at its half-way mark
Man… "Sheriff" (Nintendo, 1979) is a really good video game. It makes me want to hear Jeremy Parish spend 16 minutes describing it in low, dulcet tones like he is speaking the words of a lullaby
@bruxisma My goal is to have a CSProj mark "run this cmake file" as a dependency. There is an existing project for mac/linux where a Task invokes a build.sh that runs the cmake. I could make a build.bat for Windows. But if on Windows I could instead set a Task/Project up for "run this cmake first" without leaving msbuild, that would be real nice. The goal is to not require separate, duplicative CMakeLists.txt and Project.vcxproj for the same handful of C files.
@bruxisma Okay. Great. That's very useful as it means I can avoid wasting anymore time on this lol
I was hoping it would be as simple as putting a <ProjectReference> in my csproj target that would invoke the but it doesn't seem to be possible to refer to cmake targets / cmake target "projects" in this way (there is ONE ui pane where it uses the word "projects" but it's unclear if it means the same thing as in msbuild)
@bruxisma The script solution works okay. There is also some risk that building for [platform I can only mention in PMs] will specifically require a vcxproj.
C# question that doesn't seem particularly cursed, for once:
In MSBuild (a .csproj) I can tell a target to run at a certain time using BeforeTargets= and AfterTargets=. I know that there are certain built-in targets; one, the C# compilation step, is CoreCompile. I know this works, but I found out about it by rumor.
Where can I find documented, or how can I get msbuild/dotnet to tell me, the full list of "built-in" targets? I am esp interested in what target/step CopyToOutputDirectory occurs on