✅ Cant open .csporj

So i made a WFA and i want to edit the .csproj file but i cant open it
105 Replies
TravestyOfCode
Check if Tools > Options > Projects and Solutions > General > Open project files with double-click or the Enter key when supported. is checked.
PhoenixXeme
PhoenixXemeOP2y ago
it is
TravestyOfCode
If you right click and select Edit Project File does it open?
PhoenixXeme
PhoenixXemeOP2y ago
im new to this where is that?
PhoenixXeme
PhoenixXemeOP2y ago
reflectronic
reflectronic2y ago
you made a legacy .NET Framework project you cannot open those in VS without unloading the project first
PhoenixXeme
PhoenixXemeOP2y ago
again i and very new to this how do i do that @reflectronic how do i not make a legacy .NET Framework project?
reflectronic
reflectronic2y ago
well, it would be helpful to know what exactly you wanted to do in the project file you might be trying to do something that would not work unless you recreated the project @PhoenixXeme
PhoenixXeme
PhoenixXemeOP2y ago
im trying to publish my project so i can turn it into a exe
reflectronic
reflectronic2y ago
are you trying to use PublishSingleFile or something like that
PhoenixXeme
PhoenixXemeOP2y ago
i put the lines in
reflectronic
reflectronic2y ago
yeah, that is not going to do anything
PhoenixXeme
PhoenixXemeOP2y ago
but i get this error
PhoenixXeme
PhoenixXemeOP2y ago
oh
reflectronic
reflectronic2y ago
if you are using .NET Framework there is no such thing as publish single file
PhoenixXeme
PhoenixXemeOP2y ago
lol ok its the only way my friend showed me tho he showed me it for console apps
reflectronic
reflectronic2y ago
it works for a newer version of .NET, yes this one is too old how much coding have you done in this project so far it might be easiest to just make a new project
PhoenixXeme
PhoenixXemeOP2y ago
its finished
reflectronic
reflectronic2y ago
okay, can you paste the csproj file i will convert it to a newer version
reflectronic
reflectronic2y ago
and you will just delete the old csproj and replace it with mine
PhoenixXeme
PhoenixXemeOP2y ago
would you be able to teach me how? for furture reference
reflectronic
reflectronic2y ago
it's not a super simple process. the easiest way is to select the right template next time when you make a new project $newproject
MODiX
MODiX2y 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
PhoenixXeme
PhoenixXemeOP2y ago
ok so for now on use WFA not WFA .NET Framework ?
reflectronic
reflectronic2y ago
yes, pretty much
PhoenixXeme
PhoenixXemeOP2y ago
got it
reflectronic
reflectronic2y ago
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<OutputType>WinExe</OutputType>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>

<EmbeddedResource Update="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<OutputType>WinExe</OutputType>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>

<EmbeddedResource Update="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>
delete the entire csproj and replace it with that
PhoenixXeme
PhoenixXemeOP2y ago
done dotnet publish?
reflectronic
reflectronic2y ago
it should work now, yes
PhoenixXeme
PhoenixXemeOP2y ago
reflectronic
reflectronic2y ago
oh, sorry <TargetFramework>net7.0-windows</TargetFramework>
PhoenixXeme
PhoenixXemeOP2y ago
great no errors
PhoenixXeme
PhoenixXemeOP2y ago
PhoenixXeme
PhoenixXemeOP2y ago
looks good?
reflectronic
reflectronic2y ago
yeah. if you want to publishsinglefile you can do what the person asked you well, actually you should do dotnet publish -c Release because you are giving people the debug version otherwise
PhoenixXeme
PhoenixXemeOP2y ago
so i can just send someone the exe and it will work for them?
reflectronic
reflectronic2y ago
they might have to download .NET 7
PhoenixXeme
PhoenixXemeOP2y ago
what is i do this and the dotnet publish -c Release
reflectronic
reflectronic2y ago
they would still have to download .NET 7, but if you do <SelfContained>true</SelfContained> then they wouldn't have to but your exe will be extremely big
PhoenixXeme
PhoenixXemeOP2y ago
ok
reflectronic
reflectronic2y ago
though, i will say... this application is simple enough that you did not need PublishSingleFile before
PhoenixXeme
PhoenixXemeOP2y ago
so rn i can send someone the exe and nothing else and they will just have to install .NET7 and it will work?
reflectronic
reflectronic2y ago
yeah
PhoenixXeme
PhoenixXemeOP2y ago
great
reflectronic
reflectronic2y ago
i mean, you can try it
PhoenixXeme
PhoenixXemeOP2y ago
thank you so much for your help
reflectronic
reflectronic2y ago
copy the exe to a different folder and try opening it
MODiX
MODiX2y ago
Please don't upload any potentially harmful files @PhoenixXeme, your message has been removed
PhoenixXeme
PhoenixXemeOP2y ago
oh
reflectronic
reflectronic2y ago
you need to rename the file extension, otherwise the bot is not happy
reflectronic
reflectronic2y ago
you need to do PublishSingleFile
PhoenixXeme
PhoenixXemeOP2y ago
so for new projects i do
reflectronic
reflectronic2y ago
if you don't do it then you need to send the whole folder yeah
PhoenixXeme
PhoenixXemeOP2y ago
reflectronic
reflectronic2y ago
you forgot the / </PublishSingleFile>
PhoenixXeme
PhoenixXemeOP2y ago
XD never done html sorry
PhoenixXeme
PhoenixXemeOP2y ago
there dose not even open for me now...
reflectronic
reflectronic2y ago
this looks like the same file as before are you in the Debug folder if you use -c Release you need to look in the Release folder
PhoenixXeme
PhoenixXemeOP2y ago
i did it in C:\C# Projects\WFA_GuessingGame\WFA_GuessingGame
reflectronic
reflectronic2y ago
right, but the exe is in somewhere like WFA_GuessingGame\bin\Debug\net7.0\publish\WFA_GuessingGame.exe
PhoenixXeme
PhoenixXemeOP2y ago
C:\C# Projects\WFA_GuessingGame\WFA_GuessingGame\bin\Debug\net7.0-windows\publish yea
reflectronic
reflectronic2y ago
i think you are copying it from the wrong one if you passed -c Release
PhoenixXeme
PhoenixXemeOP2y ago
i did
reflectronic
reflectronic2y ago
you need to look in bin\Release
PhoenixXeme
PhoenixXemeOP2y ago
so cd to here C:\C# Projects\WFA_GuessingGame\WFA_GuessingGame\bin\Release and dotnet publish -c Release?
reflectronic
reflectronic2y ago
you already ran dotnet publish -c Release, right?
PhoenixXeme
PhoenixXemeOP2y ago
yea
reflectronic
reflectronic2y ago
then thee's no need to run it again
PhoenixXeme
PhoenixXemeOP2y ago
ok
reflectronic
reflectronic2y ago
i am just saying that you are looking at an old version
PhoenixXeme
PhoenixXemeOP2y ago
i thought it replaced it lol
reflectronic
reflectronic2y ago
C:\C# Projects\WFA_GuessingGame\WFA_GuessingGame\bin\Debug\net7.0-windows\publish
you are copying from bin\Debug but if you run dotnet publish -c Release then your files will be in bin\Release
PhoenixXeme
PhoenixXemeOP2y ago
PhoenixXeme
PhoenixXemeOP2y ago
PhoenixXeme
PhoenixXemeOP2y ago
PhoenixXeme
PhoenixXemeOP2y ago
what one XD
reflectronic
reflectronic2y ago
publish
PhoenixXeme
PhoenixXemeOP2y ago
PhoenixXeme
PhoenixXemeOP2y ago
so that exe
reflectronic
reflectronic2y ago
hm let me check something
PhoenixXeme
PhoenixXemeOP2y ago
💀
reflectronic
reflectronic2y ago
did you add <SelfContained>true</SelfContained>
PhoenixXeme
PhoenixXemeOP2y ago
no
reflectronic
reflectronic2y ago
oh. oh
PhoenixXeme
PhoenixXemeOP2y ago
do i need to?
reflectronic
reflectronic2y ago
sorry, they changed the way this works recently if you want the small exe you should pass --no-self-contained to dotnet publish
PhoenixXeme
PhoenixXemeOP2y ago
so dotnet publish -c Realse --no-self-contained
reflectronic
reflectronic2y ago
right then the exe will be 200kb or so, but you will need to download .NET
PhoenixXeme
PhoenixXemeOP2y ago
so do this?
reflectronic
reflectronic2y ago
right
PhoenixXeme
PhoenixXemeOP2y ago
ok
PhoenixXeme
PhoenixXemeOP2y ago
reflectronic
reflectronic2y ago
yes
PhoenixXeme
PhoenixXemeOP2y ago
please say it works
reflectronic
reflectronic2y ago
PhoenixXeme
PhoenixXemeOP2y ago
YEAAAAAAAAA WOOOO i cant thank you enough
reflectronic
reflectronic2y ago
these things can be kind of overwhelming but in the future you will get better as you learn more about how things work
PhoenixXeme
PhoenixXemeOP2y ago
yea i am very new to coding i started last week and my friend had no idea and he has beening coding in C# for 4 years but again thank you heres my github incase you want to help me 😉
PhoenixXeme
PhoenixXemeOP2y ago
GitHub
GitHub - PhoenixXeme/WFA-Guessing-Game: Guessing Game with GUI
Guessing Game with GUI. Contribute to PhoenixXeme/WFA-Guessing-Game development by creating an account on GitHub.
Accord
Accord2y 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