Solution compiles in vs2019 but not in vs2022

iqworks Information Quality Works 331 Reputation points
2023-08-19T22:46:37.8033333+00:00
Hi, I see these errors. The are all happening in my sv2022 App_Code. A few days ago, I deleted my App_Code folder for other errors at the advice of another post. 

My question is, what is different between vs2019 and vs2022 that is caused by vs2022 looking at errors differently?

Here are the questions I have.
1 – I am thinking that if I have project-a referencing project-b, then I don’t need to have the project-b.dll in the project-a’s Bin. In fact, I only need project-b in the project-a Bin if I am publishing project-a?
2 – I have a solution with a web site project called MBSAnalysis, and a class library called InformationQualityWorks . This solution compiles fine and I can debug it in vs2019. 
      When I call up the same solution in vs2022, I get this error when I try to build MBSAnalysis:
“2>D:\IQsys\MBSAnalysis4.0\MBSAnalysis\App_Code\MbsDALFood.cs(34,7): error CS0246: The type or namespace name 'InformationQualityWorks' could not be found (are you missing a using directive or an assembly reference?)”. 
 
This pic shows that the namespace is actually there :


I also, added an extra using without “.MyBodyScience”, but still the same error.

User's image

I saw this about build actions in visual studio for vs2022 web site .cs build actions

https://learn.microsoft.com/en-us/visualstudio/ide/build-actions?view=vs-2022

Set a build action

To set the build action for a file, open the file's properties in the Properties window by selecting the file in Solution Explorer and pressing Alt+Enter. Or, right-click on the file in Solution Explorer and choose Properties. In the Properties window, under the Advanced section, use the drop-down list next to Build Action to set a build action for the file.

User's image

I also wanted to change the build action for the .cs pgms in my App_Code folders, but there are no

property option in vs2022?

User's image

Thanks for any help or suggestions

Developer technologies Visual Studio Other
{count} votes

2 answers

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,436 Reputation points Microsoft External Staff
    2023-08-22T09:29:24.4633333+00:00

    Hi @iqworks Information Quality Works ,

    Thanks for your description.

    I currently notice that you are using a previous ASP .NET Web Forms Site project, this project is different from normal web application projects(ASP .NET Web Application projects). It has no project file(.csproj/.vbproj), all the files in a folder structure are automatically included in the site.

    The Build action and other parts of the properties which you saw in the document should be related to the normal ASP .NET Web Application. That’s why the property option doesn’t appear, and you cannot set the Build actions or other properties which are supported in ASP .NET Web Application projects.

    This document: Web Application Projects versus Web Site Projects in Visual Studio shows differences between them and describes the project file structure, compilation and deployment parts of these two projects, you may kindly check it.

    Best Regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. iqworks Information Quality Works 331 Reputation points
    2023-08-23T12:11:58.85+00:00

    Hi Tianyu, thanks for the link. it was very informative. The problem is that MBSAnalysis builds in vs2019. In vs2019, the property to build with the compile OPTION is not visible. And, that build option is not on vs2019 or vs2022. But, again, my MBSAnalysis project builds on vs2019.
    Why ?

    Is it possible to elevate this issue to other microsoft support people? Or do I really have to pay for this issue? That wouldnt be fair in this case.

    thanks again Tianyu for your suggestions and/or your advice.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.