C
C#7d ago
Zee

my shared projects are not found. how do I fix?

so as you can see it says my two other projects are not found but I can view them in my file explorer and open them just fine. I am assuming I just need to add them again but how? I tried doing a rebuild project but it only rebuilds one not all 3
No description
20 Replies
Zee
ZeeOP7d ago
I did move the folder too which I guess is not good
No description
x0rld
x0rld7d ago
remove them from the solution then re add them
Zee
ZeeOP7d ago
I did that and got a whole bunch of new errors now Severity Code Description Project File Line Suppression State Details Error CS0579 Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute FakeFlightBookingApp D:\Zeeshan\Documents\FakeFlightBookingApp\FakeFlightBookingAPI\obj\Debug\net8.0.NETCoreApp,Version=v8.0.AssemblyAttributes.cs 4 Active
glhays
glhays6d ago
Do you know how to hard clean your solution?
Zee
ZeeOP6d ago
nope project was working completely fine but I wanted to move those 2 folders somwehre else and now its all messed up I was jus tthinking making a new priject and copy all the files over
glhays
glhays6d ago
It is fine to move or rename, but when you do so VS is lost because you did it outside the Ide. Are two projects reloaded now.
Zee
ZeeOP6d ago
yup they are reloaded now but I cant seem to run the project as I just gives a bunch of errors
glhays
glhays6d ago
Ok, shut down VS. And go to your solution in your directory explorer Goto the root directory where the .sln file is and delete the .vs folder only this folder. Then goto each of the project folders where the .csproj files are and delete the obj and bin folders only these folders.
Zee
ZeeOP6d ago
ok thx
glhays
glhays6d ago
Restart VS, right click the solution and do the sync namespaces. When you restarted VS those folders are recreated (clean versions). So any old stuff Vs was seeing is gone. You still might need to do some cleanup. And yes your thought of recreating is an option as well.
Zee
ZeeOP6d ago
hey it works thx I just need to move these folder now saffely
glhays
glhays6d ago
Sometimes vs is to dumb being to smart.
Zee
ZeeOP6d ago
haha yh
glhays
glhays6d ago
You should remove them first make your changes then add them back and do the resync
Zee
ZeeOP6d ago
yh thanks I will try th\t just did that and followed your steps about removing vs folder and the obj and bin folder but gives a bunch of errors Severity Code Description Project File Line Suppression State Details Error CS0579 Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute FakeFlightBookingApp D:\Zeeshan\Documents\FakeFlightBookingApp\obj\Debug\net8.0-windows7.0.NETCoreApp,Version=v8.0.AssemblyAttributes.cs 4 Active this is one of th 17 do you recoginise this error? i think theres some duplications going on that messes it up
glhays
glhays6d ago
Open the .csproj file of the FakeFlightBookingApp project and ensure that there is only one <TargetFramework> tag defined.
Zee
ZeeOP6d ago
I do and still getting an error
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2903.40" />
<PackageReference Include="Refractored.MvvmHelpers" Version="1.6.2" />
<PackageReference Include="SendGrid" Version="9.29.3" />
<PackageReference Include="Stripe.net" Version="47.1.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="FakeFlightBookingAPI\FakeFlightBookingAPI.csproj" />
<ProjectReference Include="SharedModels\SharedModels.csproj" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2903.40" />
<PackageReference Include="Refractored.MvvmHelpers" Version="1.6.2" />
<PackageReference Include="SendGrid" Version="9.29.3" />
<PackageReference Include="Stripe.net" Version="47.1.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="FakeFlightBookingAPI\FakeFlightBookingAPI.csproj" />
<ProjectReference Include="SharedModels\SharedModels.csproj" />
</ItemGroup>
</Project>
nvm
glhays
glhays6d ago
Curiosity did you get it fixed? If so is this correct? I do not do much desktop dev.
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows7.0</TargetFramework>
Net8.0-windows7.0
Zee
ZeeOP5d ago
I did get it fixed by keeping the projects in separate folders as it turns out its bad practice to place a project folder into another project folder I asked this question in #help-0 and was told its bad practice is placing a new project folder inside an already existing project folder bad practice? I ask because I made a WPF project named FakeFLightBooking and I made an ASP.NetCore WEB API project named FakeFLightBookingAPI and I placed the ASP project in my FakeFLightBooking WPF project is that ok or considered as bad code practice? this was one of the answers "i certainly wouldn't recommend putting projects inside projects multiple projects inside a solution, go for your life you are "allowed" to nest projects inside other projects on disk if you want, but relative paths and project references can get weird with it sometimes so it's generally not recommended"
glhays
glhays5d ago
Think of it in this way. Within a solution your managing projects (.csproj) files. Wether you want to structure a folder system like you stated that is entirely your choice to do so. Yes not a common practice. The headache begins when you decide on moving or renaming these, folders in VS are namespaces. You have already discovered this. Overall it really depends on the architecture of the systems your building. Class libraries are compiled dll's so no relative path issues can arise, but if your combining api projects then yes they may, and you will have to deal with it. Common or bad practice, these days of development one has to decide what path they want follow.
Want results from more Discord servers?
Add your server