Visual Studio command created code that had a Virus

garrett kennedy 20 Reputation points
2025-02-08T18:22:46.5666667+00:00

In Visual Studio(I found out there are two versions, its named "Visual Studio Code"), in the terminal, I entered the command: "dotnet new console -o ./CsharpProjects/TestProject" as required by a course I am doing. It created some folders and code files, when typing "dotnet build" it was loading for a while and then my Norton Security gave me an alert saying it blocked a file called TestProject.dll. The TestProject.dll file had a threat called "Win32:TrojanX-gen [Trj]" and that it was a Trojan Horse. Now the file is gone and running "dotnet build" gives the error: CSC : error CS2012: Cannot open 'C:\Users\Kenne\OneDrive\Desktop\CsharpProjects\TestProject\obj\Debug\net9.0\refint\TestProject.dll' for writing -- 'Access to the path 'C:\Users\Kenne\OneDrive\Desktop\CsharpProjects\TestProject\obj\Debug\net9.0\refint\TestProject.dll' is denied.'

Is there a way to run the command dotnet build without that file? Or is it possible to get a version of that file that does not contain a Trojan Horse? since the file already exists I cannot re-enter "dotnet new console -o ./CsharpProjects/TestProject"

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,448 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anna Xiu-MSFT 30,936 Reputation points Microsoft External Staff
    2025-02-10T03:43:03.0333333+00:00

    Hi @garrett kennedy

    Welcome to Microsoft Q&A! 

    You can try to create a new console application. If it persists, it may be a false positive. I suppose you can report it to Norton. 

    By the way, the tag “Visual Studio” is related to Visual Studio product, Visual Studio and Visual Studio Code are different product, I recommend you post it to the GitHub-vscode forum where you would get support for this product. Thanks for your understanding. 

    Sincerely,

    Anna


    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.