C
C#12mo ago
NullIntended

❔ how to export project to .exe

Hey I have a project I'm trying to export to .exe. I see a lot of videos but their layout looks different. I have 2019 and 2022 installed. I'm using newest version of .net framework. I do not have one click which is what I think makes the .exe instead of manifests.
114 Replies
Angius
Angius12mo ago
Newest version of .NET or of .NET Framework? In any case, the publish wizard should guide you
NullIntended
NullIntended12mo ago
I just noticed I had 4.7 as my framework... I downloaded 7.0 but I'm not seeing it as a selection for target framework
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
This is what I downloaded
SG97
SG9712mo ago
so the project is .net framework
NullIntended
NullIntended12mo ago
Yes
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
This isn't what the YouTube videos show when they click public but this is my public
Angius
Angius12mo ago
If you made the project with .NET Framework, switching it to .NET Core or .NET is not simple, hence it doesn't show up in the version selector $newproject
MODiX
MODiX12mo ago
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework. .NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended. https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
Angius
Angius12mo ago
Well, click through the wizard and see what happens
NullIntended
NullIntended12mo ago
So I can't get a .exe from a .netframework forms?
Angius
Angius12mo ago
You can
NullIntended
NullIntended12mo ago
How so? I'll show u what it installs one sec
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
But inside application files is just manifests, no exe When I run setup it just gives an app no .exe compiled
Angius
Angius12mo ago
You probably told the wizard to create some setup with an installer, ClickOnce, or something like that
NullIntended
NullIntended12mo ago
When I run setup, it gives this
NullIntended
NullIntended12mo ago
I never had that option. I just told it to download to folder
NullIntended
NullIntended12mo ago
This is the option I select
Angius
Angius12mo ago
So you are creating an installer
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
Then this. I'm not wanting an installer.... it gives me no other choices
Angius
Angius12mo ago
Change the output type?
NullIntended
NullIntended12mo ago
To?
Angius
Angius12mo ago
Idk, it's been ages since I used the ancient Framework last What are the types available?
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
None of them seem correct
Angius
Angius12mo ago
¯\_(ツ)_/¯ then
NullIntended
NullIntended12mo ago
Other than application Fck Thanks for trying 😄
Angius
Angius12mo ago
And for future reference, don't use .NET Framework unless you really hate yourself .NET is the way to go
NullIntended
NullIntended12mo ago
Ok I can rebuild the project
Angius
Angius12mo ago
I mean, if you want to, sure You can use Upgrade Assistant to upgrade the project to .NET 7 Or you can create a new, .NET 7 project, and just copy the code over Chances are it'll work
NullIntended
NullIntended12mo ago
I don't have an option without net framework Upgrade assistant?
Angius
Angius12mo ago
$newproject
MODiX
MODiX12mo ago
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework. .NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended. https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
Angius
Angius12mo ago
None of those options?
NullIntended
NullIntended12mo ago
Yes that's not a thing on mine Only some I'll show u
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
Angius
Angius12mo ago
Weird Is this VS2022?
NullIntended
NullIntended12mo ago
Let me verify it's not 2019 Ah 2022 has it I'll try the upgrade assistant first Ok installed that. Does it do it automatically?
NullIntended
NullIntended12mo ago
I did It's upgrading Ok so I have a .exe but it only runs in my debug folder @ZZZZZZZZZZZZZZZZZZZZZZZZZ Sent to my buddy and it won't load, I put it on my desktop and won't load In debug? It loads
Angius
Angius12mo ago
It's an exe and a bunch of other files, would be my guess? All of them are needed Unless you publish it in single-file mode
NullIntended
NullIntended12mo ago
How can I compile them all into the exe?
Angius
Angius12mo ago
$singlefile
MODiX
MODiX12mo ago
dotnet publish -c Release -r <runtime identifier> -p:PublishSingleFile=true Use of -r|--runtime implies --self-contained true. Add --self-contained false to publish as runtime-dependent. -r RID and -p:PublishSingleFile=true can be moved to .csproj as the following properties:
<RuntimeIdentifier>RID</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>RID</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
but to target multiple RIDs, you have to use dotnet publish with the -r option for each RID. You can also add -p:IncludeNativeLibrariesForSelfExtract=true to include native libraries (like Common Language Runtime dlls) in the output executable. You might want to instead publish your application compiled Ahead Of Time to native code, see $nativeaot for examples. https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file https://docs.microsoft.com/en-us/dotnet/core/rid-catalog https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish
Create a single file for application deployment - .NET
Learn what single file application is and why you should consider using this application deployment model.
.NET Runtime Identifier (RID) catalog
Learn about the runtime identifier (RID) and how RIDs are used in .NET.
NullIntended
NullIntended12mo ago
Ok let me publish it
Angius
Angius12mo ago
Here's how to do it from the CLI, but the wizard should have a checkbox as well
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
Through wizard. I can't run it on my desktop by itself
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
The docs are outdated. This is my picture of deployment
Angius
Angius12mo ago
The output is bin/Publish not bin/Release And don't deploy as ClickOnce Nor to Azure Publish to folder
NullIntended
NullIntended12mo ago
No good. Just tried all of those
NullIntended
NullIntended12mo ago
Angius
Angius12mo ago
You're still looking into the bin/Release folder
NullIntended
NullIntended12mo ago
Im sending a list of pics
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
All the pics I'm sending do not work singled out
Angius
Angius12mo ago
NullIntended
NullIntended12mo ago
Yes
Angius
Angius12mo ago
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
No exe In the application files, it's all deploy files It's not giving an exe
Angius
Angius12mo ago
Idk then, try the CLI I guess
NullIntended
NullIntended12mo ago
What file would I use it on? I tried it on sln and it wouldn't
MODiX
MODiX12mo ago
MODiX#0152
dotnet publish -c Release -r <runtime identifier> -p:PublishSingleFile=true Use of -r|--runtime implies --self-contained true. Add --self-contained false to publish as runtime-dependent. -r RID and -p:PublishSingleFile=true can be moved to .csproj as the following properties:
<RuntimeIdentifier>RID</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>RID</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
but to target multiple RIDs, you have to use dotnet publish with the -r option for each RID. You can also add -p:IncludeNativeLibrariesForSelfExtract=true to include native libraries (like Common Language Runtime dlls) in the output executable. You might want to instead publish your application compiled Ahead Of Time to native code, see $nativeaot for examples. https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file https://docs.microsoft.com/en-us/dotnet/core/rid-catalog https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish
Embed Type
Link
Quoted by
From MODiX#0152
React with ❌ to remove this embed.
NullIntended
NullIntended12mo ago
dotnet publish -r win-x64 BackupSystem.sln doesn't work when doing it
chef drone builder
You need to enable file extensions to see the file extension….
Angius
Angius12mo ago
Try using it on the project
chef drone builder
Setup looks like an exe to me
Angius
Angius12mo ago
Or just don't specify any file
NullIntended
NullIntended12mo ago
Angius
Angius12mo ago
Just cd into the solution directory and
dotnet publish -c Release -r win-x64 -p:PublishSingleFile=true
dotnet publish -c Release -r win-x64 -p:PublishSingleFile=true
NullIntended
NullIntended12mo ago
Ur reading it wrong completely. Where can I change my build folder? So it will build in a different folder. This one became a mess
Angius
Angius12mo ago
Just delete it then You can safely delete the whole bin
NullIntended
NullIntended12mo ago
It has my sln in it....
Angius
Angius12mo ago
how
NullIntended
NullIntended12mo ago
It requires sln
Angius
Angius12mo ago
Wtf
NullIntended
NullIntended12mo ago
Yeah I'll send pic one sec dotnet publish -c Release -r win-x64 -p:PublishSingleFile=true Ignore that
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
When I ran it in my folder it tells me this It contains only my project currently
Angius
Angius12mo ago
Means you probably made the mistake of placing your project in the same folder as the solution In that case, specify the project file
NullIntended
NullIntended12mo ago
Ok dotnet publish -c Release -r win-x64 -p:PublishSingleFile=true SPECIFY HERE?
Angius
Angius12mo ago
I think so?
NullIntended
NullIntended12mo ago
Specify the sln?
Angius
Angius12mo ago
The csproj
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
The sln is the only thing I see close to that Unless u mean form1
Angius
Angius12mo ago
Because you have file extensions turned off Or maybe not?
Angius
Angius12mo ago
Angius
Angius12mo ago
Why does this not have an extension?
NullIntended
NullIntended12mo ago
NullIntended
NullIntended12mo ago
My file extensions is on???
Angius
Angius12mo ago
Well, that extension wasn't showing for some reason
Angius
Angius12mo ago
Now it does show
Angius
Angius12mo ago
Su, this is your .csproj file
NullIntended
NullIntended12mo ago
Ohhhhh If I rename it to BackupSystem would it break everything
Angius
Angius12mo ago
Idk, it might
NullIntended
NullIntended12mo ago
How can I rename it then? Properly It can't have a space in it
Angius
Angius12mo ago
Why?
NullIntended
NullIntended12mo ago
Ok this is the same issue So it compiled to an exe Move exe to desktop, doesn't work. Keep in folder? Works
Angius
Angius12mo ago
Yeah, at this point I've no clue what's going on
NullIntended
NullIntended12mo ago
Omg I got it!!!! dotnet publish -c Release -r win-x64 -p:PublishSingleFile=true --self-contained true BackupSystem.csproj Missed the --self contained I'm 100% saving this in my notes lmao
Angius
Angius12mo ago
Ah, there you go
NullIntended
NullIntended12mo ago
Tyvm @ZZZZZZZZZZZZZZZZZZZZZZZZZ !!!
Angius
Angius12mo ago
Anytime
NullIntended
NullIntended12mo ago
My first ever c# project is now complete >:D
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ How to access a button from a different class?Hello. Recently, I was developing a project and decided to start splitting my code into separate fil✅ Trouble importing LoggerService namespace with ILoggerService in .NET Core APICould someone help me with this error? I can't import the LoggerService namespace no matter what I t✅ What's the easiest type of information storage?I'm new to C# and when I was starting out with Python, the first type of data storage I learned was Unable to create an object of type 'DBCSDBContext'. For the different patterns supported at design tHey I've developed an application using Entity Framework Core and PostgreSQL, and I've encountered a✅ Listview colorHow do i put a different color for a specific item of a listview?❔ Blazor TypeConverter Exception```csharp [TypeConverter(typeof(IListStringConverter))] public List<string> Accepted✅ Docker + Blazor + EF Core 7 + SQLite = __EFMigrationsHistory doesnt existHello everyone i am new to docker and i am attempting to containerize an existing project. I've got ✅ What is the best way to setup app configuration using IHostBuilder?I want to make a good building of my host configuration and make it convenient to use. My goal is to❔ ef migration merges 2 tables of same type?<:kekw:710973294886649956> so my dbcontext that has two seperate tables of "Char" classes results ❔ Problem with converting WAV byte[] to MP3 byte[] (and vice versa)I have this code (using NAudio) for converting a wav byte array to an mp3 byte array: ```csharp