最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Feature 'global using directive is not available in c# 7.3 - Stack Overflow

programmeradmin1浏览0评论

All the orojects in my solution have GenerateGlobalUsings false

However when I build I get an error

Feature 'global using directive' is not available in C# 7.3. Please use language version 10.0 or greater.

My startup project is

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net48</TargetFramework>
    <LangVersion>7.3</LangVersion>
    <GenerateGlobalUsings>false</GenerateGlobalUsings>
    <UseWindowsForms>true</UseWindowsForms>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="MYOB.AccountRight.API.SDK" Version="2024.10.641" />
    <PackageReference Include="System.Security.AccessControl" Version="6.0.1" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\SBD.MyobSync\DataModule\DataModule.csproj" />
    <ProjectReference Include="..\SBD.MyobSync\SBD.MyobApi\MYOBAPI\SBD.Myob.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="System.Configuration" />
  </ItemGroup>

  <ItemGroup>
    <None Update="appsettings.config">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Update="connections.config">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>

I have tried cleaning and rebuilding I have tried deleting the bin and obj folders I have tried exiting Visual Studio

I have tried deleting the context of the generated file I am using VS 17.12.4 I have looked at this ticket but since language 7.3 is the default for net48 I dont think the answer is to move away from it.

All the orojects in my solution have GenerateGlobalUsings false

However when I build I get an error

Feature 'global using directive' is not available in C# 7.3. Please use language version 10.0 or greater.

My startup project is

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net48</TargetFramework>
    <LangVersion>7.3</LangVersion>
    <GenerateGlobalUsings>false</GenerateGlobalUsings>
    <UseWindowsForms>true</UseWindowsForms>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="MYOB.AccountRight.API.SDK" Version="2024.10.641" />
    <PackageReference Include="System.Security.AccessControl" Version="6.0.1" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\SBD.MyobSync\DataModule\DataModule.csproj" />
    <ProjectReference Include="..\SBD.MyobSync\SBD.MyobApi\MYOBAPI\SBD.Myob.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="System.Configuration" />
  </ItemGroup>

  <ItemGroup>
    <None Update="appsettings.config">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Update="connections.config">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>

I have tried cleaning and rebuilding I have tried deleting the bin and obj folders I have tried exiting Visual Studio

I have tried deleting the context of the generated file I am using VS 17.12.4 I have looked at this ticket but since language 7.3 is the default for net48 I dont think the answer is to move away from it.

Share Improve this question asked yesterday KirstenKirsten 18.1k50 gold badges206 silver badges358 bronze badges 2
  • 1 The Windows Forms App (.NET Framework) template doesn't create a SDK style project. You can open the .csproj file using Notepad to view it. If you desire to have a .NET Framework project that is SDK style, then you may consider creating it normally. Then Install .NET Upgrade Assistant. If you don't already have PowerShell installed, then Installing PowerShell on Windows. – It all makes cents Commented yesterday
  • 1 Make a backup copy of your solution. Open PowerShell, and follow the directions in Upgrade projects with .NET Upgrade Assistant or the directions in How to create an SDK-style .NET Framework project in VS? to upgrade each project in your solution. – It all makes cents Commented yesterday
Add a comment  | 

1 Answer 1

Reset to default 0

I removed

<ImplicitUsings>enable</ImplicitUsings>

And was able to move to the next error.

发布评论

评论列表(0)

  1. 暂无评论