aspnet-codegenerator: Microsoft.VisualStudio.Web.CodeGeneration.Design eklendikten sonra bile kullanılabilir kod üreteci yok
Aspnet-codegenerator kullanarak iskele oluşturulamıyor , aşağıda denediğim şey:
Kullanılarak bir ASP.Net RazorPages uygulaması oluşturuldu
dotnet new webappYaptı
dotnet buildDotnet-aspnet-codegenerator kullanılarak yüklendi
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.4Koştu
dotnet aspnet-codegenerator --helpYazıyor: Bu projede kod oluşturucu yok . Projeye NuGet paketi başvurusu olarak Microsoft.VisualStudio.Web.CodeGeneration.Design paketini ekleyin.
4. adımda belirtilen paketi kullanarak
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.DesignEklenen paket:
<ItemGroup> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" /> </ItemGroup>Yine koştu:
dotnet buildSon adım
Koştu
dotnet aspnet-codegenerator --helpYine diyor ki: Bu projede hiçbir kod üreteci yok. Microsoft.VisualStudio.Web.CodeGeneration.Design paketini projeye NuGet paket başvurusu olarak ekleyin.
.Net çekirdek yüklü sürüm: 3.1.401
İşletim Sistemi: Ubuntu 20.04
Yanıtlar
Bu zaten birkaç aylık, ancak son zamanlarda tüm projelerim için bununla karşılaştım.
Bu sayfaya başka birinin gelmesi durumunda, benim durumumdaki çözüm (MAC OS), dotnet-aspnet-codegenerator'ü kaldırıp yeniden yüklemekti.
Terminalde çalıştır:
dotnet tool uninstall --global dotnet-aspnet-codegenerator
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.4
Emrini test ediyorum ve bunu dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.4yaptığımda alabilirim
ve sonra sizinle Ran dotnet aspnet-codegenerator --helpaynı mesajı alıyorum No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet, ancak aşağıdakileri yaptığımda mesaj olmadan koşabiliyorum:
Sanırım paket doğru eklenmemiş olabilir, kaldırıp tekrar eklemeyi deneyebilirsiniz.
dotnet remove package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
Bu soruna ÇÖZÜM buldum:
En yeni sürümler bazı problemler veriyor, bu nedenle terminalde şu komutu yazarak sdk sürümünü 3.1.3'e düşürmeniz gerekecek :
sudo apt yükleme dotnet-sdk-3.1 = 3.1.301-1
Bundan sonra aşağıdakileri yüklemeniz gerekecek:
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.3
Bundan sonra, bunu terminale yazarak doğru Web.CodeGeneration.Design Paketini eklemeniz gerekecektir:
sudo apt install dotnet-sdk-3.1 = 3.1.301-1 dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.3
Bu benim için çalıştı !!
.Net core 3.1.4'ten 5.0.1'e yükseltirken de aynı sorunu yaşıyorum.
Çözümüm:
- genel araçları güncelleyin:
dotnet tool install --global dotnet-aspnet-codegenerator
dotnet tool update --global dotnet-aspnet-codegenerator
dotnet tool install --global dotnet-ef
dotnet tool update --global dotnet-ef
- paketlere bağlantı ekle / güncelle
dotnet remove package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet add package Add package Microsoft.EntityFrameworkCore.Design
- Dizesini değiştirin
netcoreapp3.1.4içinnet5.0.csproj ve launch.json dosyalarında - Dizinleri temizle
- çöp Kutusu
- obj
- Yeniden inşa projesi
- Sonunda çalıştırın:
dotnet aspnet-codegenerator --help
Her şey yolunda giderse, mevcut jeneratörleri gösterecektir.