Issue to code

Peter_1985 2,466 Reputation points
2021-03-10T00:33:13.313+00:00

Hi,
How to resolve issue like

Severity Code Description Project File Line Suppression State
Error CS0116 A namespace cannot directly contain members such as fields or methods

due to 2nd line below?

[assemblf: AssemblyVersion("1.0.0.0")]
[assemblf: AssemblyFileVersion("1.0.0.0")]

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,512 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,540 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
924 questions
0 comments No comments
{count} votes

3 additional answers

Sort by: Most helpful
  1. Xingyu Zhao-MSFT 5,356 Reputation points
    2021-03-10T02:48:08.443+00:00

    Hi @Peter_1985 ,

    Error CS0116 A namespace cannot directly contain members such as fields or methods

    Methods and variables must be declared and defined within a struct or class. Check : Compiler Error CS0116
    AssemblyVersionAttribute is used to specify the version of the assembly being attributed. See : Details of Assembly version

    Besides, if you need further assistance, please provide some related code here. It will help us analzye your problem.

    Best Regards,
    Xingyu Zhao
    *
    If the answer is helpful, please click "Accept Answer" and upvote it.
    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.

    1 person found this answer helpful.
    0 comments No comments

  2. Karen Payne MVP 35,016 Reputation points
    2021-03-10T01:37:38.4+00:00

    This information belongs in (from solution explorer) and not heard of the two you mentioned.

    Properties -> AssemblyInfo.cs

    75980-f1.png


  3. Peter_1985 2,466 Reputation points
    2021-03-10T03:24:20.487+00:00

    Hi,
    Can you see why issue arises, on project below?

    https://1drv.ms/u/s!Ai8CrEskdewXviZDoFuhOSfP3DZi?e=foAgsI

    0 comments No comments