Click here to Skip to main content
15,914,500 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
So I've Been Making A Simple C# Console Program In VsCode And I Use The .Net 6 , And When I Finished Making The Code I Built It And Published It , And When I Click On Exe File It Runs Normally , But When I Take It Out Of The Project folder i cant run it anymore And i tried sending The whole project to my friend and he couldn't run it too

So please is there anything im missing
Sorry for bad explaination

What I have tried:

I tried publishing it and building it and sending the whole file but i still cant
Get the program to work
Posted
Updated 22-Jan-22 3:13am

Chances are it needs the right version of the .NET framework - the easiest way to make sure it will work is to use an installation program rather than "sending the EXE file" to him.

Try adding a Deployment project to your solution - that should allow you to build an installer with will ensure that everything needed is there.
 
Share this answer
 
v2
Try to publish as self-contained:
Quote:
Publishing your app as self-contained produces an application that includes the .NET runtime and libraries, and your application and its dependencies. Users of the application can run it on a machine that doesn't have the .NET runtime installed.

See: Application publishing - .NET | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900