C
C#13mo ago
PhoenixXeme

✅ Cant open .csporj

So i made a WFA and i want to edit the .csproj file but i cant open it
105 Replies
TravestyOfCode
TravestyOfCode13mo ago
Check if Tools > Options > Projects and Solutions > General > Open project files with double-click or the Enter key when supported. is checked.
PhoenixXeme
PhoenixXeme13mo ago
it is
TravestyOfCode
TravestyOfCode13mo ago
If you right click and select Edit Project File does it open?
PhoenixXeme
PhoenixXeme13mo ago
im new to this where is that?
PhoenixXeme
PhoenixXeme13mo ago
reflectronic
reflectronic13mo ago
you made a legacy .NET Framework project you cannot open those in VS without unloading the project first
PhoenixXeme
PhoenixXeme13mo 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
reflectronic13mo 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
PhoenixXeme13mo ago
im trying to publish my project so i can turn it into a exe
reflectronic
reflectronic13mo ago
are you trying to use PublishSingleFile or something like that
PhoenixXeme
PhoenixXeme13mo ago
i put the lines in
reflectronic
reflectronic13mo ago
yeah, that is not going to do anything
PhoenixXeme
PhoenixXeme13mo ago
but i get this error
PhoenixXeme
PhoenixXeme13mo ago
oh
reflectronic
reflectronic13mo ago
if you are using .NET Framework there is no such thing as publish single file
PhoenixXeme
PhoenixXeme13mo ago
lol ok its the only way my friend showed me tho he showed me it for console apps
reflectronic
reflectronic13mo 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
PhoenixXeme13mo ago
its finished
reflectronic
reflectronic13mo ago
okay, can you paste the csproj file i will convert it to a newer version
reflectronic
reflectronic13mo ago
and you will just delete the old csproj and replace it with mine
PhoenixXeme
PhoenixXeme13mo ago
would you be able to teach me how? for furture reference
reflectronic
reflectronic13mo 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
MODiX13mo 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
PhoenixXeme13mo ago
ok so for now on use WFA not WFA .NET Framework ?
reflectronic
reflectronic13mo ago
yes, pretty much
PhoenixXeme
PhoenixXeme13mo ago
got it
reflectronic
reflectronic13mo 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
PhoenixXeme13mo ago
done dotnet publish?
reflectronic
reflectronic13mo ago
it should work now, yes
PhoenixXeme
PhoenixXeme13mo ago
reflectronic
reflectronic13mo ago
oh, sorry <TargetFramework>net7.0-windows</TargetFramework>
PhoenixXeme
PhoenixXeme13mo ago
great no errors
PhoenixXeme
PhoenixXeme13mo ago
PhoenixXeme
PhoenixXeme13mo ago
looks good?
reflectronic
reflectronic13mo 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
PhoenixXeme13mo ago
so i can just send someone the exe and it will work for them?
reflectronic
reflectronic13mo ago
they might have to download .NET 7
PhoenixXeme
PhoenixXeme13mo ago
what is i do this and the dotnet publish -c Release
reflectronic
reflectronic13mo 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
PhoenixXeme13mo ago
ok
reflectronic
reflectronic13mo ago
though, i will say... this application is simple enough that you did not need PublishSingleFile before
PhoenixXeme
PhoenixXeme13mo 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
reflectronic13mo ago
yeah
PhoenixXeme
PhoenixXeme13mo ago
great
reflectronic
reflectronic13mo ago
i mean, you can try it
PhoenixXeme
PhoenixXeme13mo ago
thank you so much for your help
reflectronic
reflectronic13mo ago
copy the exe to a different folder and try opening it
MODiX
MODiX13mo ago
Please don't upload any potentially harmful files @PhoenixXeme, your message has been removed
PhoenixXeme
PhoenixXeme13mo ago
oh
reflectronic
reflectronic13mo ago
you need to rename the file extension, otherwise the bot is not happy
reflectronic
reflectronic13mo ago
you need to do PublishSingleFile
PhoenixXeme
PhoenixXeme13mo ago
so for new projects i do
reflectronic
reflectronic13mo ago
if you don't do it then you need to send the whole folder yeah
PhoenixXeme
PhoenixXeme13mo ago
reflectronic
reflectronic13mo ago
you forgot the / </PublishSingleFile>
PhoenixXeme
PhoenixXeme13mo ago
XD never done html sorry
PhoenixXeme
PhoenixXeme13mo ago
there dose not even open for me now...
reflectronic
reflectronic13mo 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
PhoenixXeme13mo ago
i did it in C:\C# Projects\WFA_GuessingGame\WFA_GuessingGame
reflectronic
reflectronic13mo ago
right, but the exe is in somewhere like WFA_GuessingGame\bin\Debug\net7.0\publish\WFA_GuessingGame.exe
PhoenixXeme
PhoenixXeme13mo ago
C:\C# Projects\WFA_GuessingGame\WFA_GuessingGame\bin\Debug\net7.0-windows\publish yea
reflectronic
reflectronic13mo ago
i think you are copying it from the wrong one if you passed -c Release
PhoenixXeme
PhoenixXeme13mo ago
i did
reflectronic
reflectronic13mo ago
you need to look in bin\Release
PhoenixXeme
PhoenixXeme13mo ago
so cd to here C:\C# Projects\WFA_GuessingGame\WFA_GuessingGame\bin\Release and dotnet publish -c Release?
reflectronic
reflectronic13mo ago
you already ran dotnet publish -c Release, right?
PhoenixXeme
PhoenixXeme13mo ago
yea
reflectronic
reflectronic13mo ago
then thee's no need to run it again
PhoenixXeme
PhoenixXeme13mo ago
ok
reflectronic
reflectronic13mo ago
i am just saying that you are looking at an old version
PhoenixXeme
PhoenixXeme13mo ago
i thought it replaced it lol
reflectronic
reflectronic13mo 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
PhoenixXeme13mo ago
PhoenixXeme
PhoenixXeme13mo ago
PhoenixXeme
PhoenixXeme13mo ago
PhoenixXeme
PhoenixXeme13mo ago
what one XD
reflectronic
reflectronic13mo ago
publish
PhoenixXeme
PhoenixXeme13mo ago
PhoenixXeme
PhoenixXeme13mo ago
so that exe
reflectronic
reflectronic13mo ago
hm let me check something
PhoenixXeme
PhoenixXeme13mo ago
💀
reflectronic
reflectronic13mo ago
did you add <SelfContained>true</SelfContained>
PhoenixXeme
PhoenixXeme13mo ago
no
reflectronic
reflectronic13mo ago
oh. oh
PhoenixXeme
PhoenixXeme13mo ago
do i need to?
reflectronic
reflectronic13mo 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
PhoenixXeme13mo ago
so dotnet publish -c Realse --no-self-contained
reflectronic
reflectronic13mo ago
right then the exe will be 200kb or so, but you will need to download .NET
PhoenixXeme
PhoenixXeme13mo ago
so do this?
reflectronic
reflectronic13mo ago
right
PhoenixXeme
PhoenixXeme13mo ago
ok
PhoenixXeme
PhoenixXeme13mo ago
reflectronic
reflectronic13mo ago
yes
PhoenixXeme
PhoenixXeme13mo ago
please say it works
reflectronic
reflectronic13mo ago
PhoenixXeme
PhoenixXeme13mo ago
YEAAAAAAAAA WOOOO i cant thank you enough
reflectronic
reflectronic13mo 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
PhoenixXeme13mo 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
PhoenixXeme13mo 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
Accord13mo 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
✅ Restore a PackageReference and use contained MSBBuild scripts inside of .targets fileHey folks, I have a CICD script that executes a custom target `Foo.targets` using `dotnet msbuild F❔ Cross-platform 3D rendering library?Hello, I am working on an application/tool to generate 3D models. I was wondering if there was a goo✅ How to make a custom converter in .net 6.0 using wpf?Hello, sorry I couldn't find anything useful using google so i'm asking here, sorry if it's obvious.❔ How does the main method work?I've only ever used c# in unity, so i've never worked outside the context of making games, so using ❔ ✅ How to implement pool tracking in concurrent list ?I am trying to add tracking to my logging service. (Web API project) Once track count is matched, I ❔ GraphQL for ASP.NET 7 subscription serviceAre there any tutorial/articles on how to implement a GraphQL api for ASP.NET 7 subscription service❔ Entity relationship HelpI am getting started on a project using .net mvc identity and I am kinda new at this Here is how the❔ Panel with Datagridview problem (forms)I have a panel containing 37 datagridviews, I have another identical window with the same code but i❔ Best pattern to alleviate the pain of a many-to-many unit conversion program?For example, converting gallons to any other volumetric unit and vice versa❔ (WPF App) Show terminal window with all output, but also read it with code and catch errors.Hi, I don't know how to show all the output in terminal window when `RedirectStandardOutput` and `Re