Eu estou tentando seguir com o curso, mas meu código não consegue finalizar a build, eu uso um arquivo chamado "Musica.cs" como o local da função, o arquivo "Program.cs" como programa principal, alguém consegue me explicar porque? (Uso o Dotnet 10)
Program.cs
Musica musica1 = new Musica
{
nome = "Rap God",
artista = "Eminem",
duracao = 67,
disponivel = true
};
musica1.MostraDados();
Musicas.cs
public class Musica
{
public string nome = "";
public string artista = "";
public int duracao = 0;
public bool disponivel;
public void MostraDados()
{
System.Console.WriteLine($"Nome: {nome}\nArtista: {artista}\nDuração: {duracao}");
if (disponivel)
{
System.Console.WriteLine("Musica disponível para seu plano!");
}
else
{
System.Console.WriteLine("Obtenha o plano Plus+Jr para desbloquear!");
}
}
}
C# Alura.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>C__Alura</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
C# Alura.sln
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C# Alura", "C# Alura.csproj", "{A3021DE0-C795-9174-4558-055AEEE4FFEB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A3021DE0-C795-9174-4558-055AEEE4FFEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3021DE0-C795-9174-4558-055AEEE4FFEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3021DE0-C795-9174-4558-055AEEE4FFEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3021DE0-C795-9174-4558-055AEEE4FFEB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {20FA3E14-0195-4EBB-9A4E-F8E007C8BD7F}
EndGlobalSection
EndGlobal
Erro no Terminal
* Executing task: dotnet: build c:\Users\ThinkPad\Desktop\Alura\C#\Project1\Program.cs
dotnet build c:\Users\ThinkPad\Desktop\Alura\C#\Project1\Program.cs /property:GenerateFullPaths=true
C# extension build result service is available.
Determining projects to restore...
All projects are up-to-date for restore.
c:\Users\ThinkPad\Desktop\Alura\C#\Project1\Program.cs(1,1): error CS0246: The type or namespace name 'Musica' could not be found (are you missing a using directive or an assembly reference?)
c:\Users\ThinkPad\Desktop\Alura\C#\Project1\Program.cs(1,22): error CS0246: The type or namespace name 'Musica' could not be found (are you missing a using directive or an assembly reference?)
* The terminal process terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
Obs: Desculpe por não usar o GitHub, ainda não aprendi como usa-lo.