I have just started using Visual Studio 2013 with EF6 and I have created a demo application with MVC 4. I tried to scaffold a controller but i keep getting an error. I have installed MVCScaffolding from the Package Manager Console and everything installed correctly including T4Scaffolding, T4Scaffolding.Core... however I keep getting this error. Please help me out
Invoke-Scaffolder : A positional parameter cannot be found that accepts argument 'Student'.
At line:1 char:1
+ Scaffold Controller Student -Repository
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-Scaffolder], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,T4Scaffolding.Cmdlets.InvokeScaffolderCmdlet
Please tell me what I am doing wrong. Thanks A lot
I had a similar problem. Try with MVC 5.
Thank you for the suggestions. I solved this by using this command instead. Worked like a charm.
Install-Package MvcScaffolding -Version 1.0.8-vs2013 -Pre
I got it from this another question
Related
I am using dotnet core 2 and visual studio 2019 and I have several db contexts. But I want to add a migration to the MedicalDbContext. And I have also more default projects. But the right default project is HepEngine. So I select that project als default project in Package manager.
And in the command prompt: PM>Add-Migration add-echeq-alert-action-extraProperty -c medicalDbContext -s
But then I get this error:
Add-Migration : Missing an argument for parameter 'StartupProject'. Specify a parameter of type 'System.String' and try again.
At line:1 char:72
+ ... Migration add-echeq-alert-action-extraProperty -c medicalDbContext -s
+ ~~
+ CategoryInfo : InvalidArgument: (:) [Add-Migration], ParameterBindingException
+ FullyQualifiedErrorId : MissingArgument,Add-Migration
So what I have to change? Thank you
If you have more than one DataContext, you need to specify for which context the migration should be created. For my projects, I'm using this code
add-migration YOURMIGRATIONNAME -context MyDbContext
where MyDbContext is the name of your context.
You can find the documentation here.
I'm new to Umbraco CMS, and I followed the tutorial from this site to install the umbraco cms in my visual studio.
https://our.umbraco.org/documentation/getting-started/setup/install/install-umbraco-with-nuget
However I got this error
Install-Package : Specified condition "$(WebProjectOutputDirInsideProject)" evaluates to "" instead of a boolean. C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets
At line:1 char:1
+ Install-Package UmbracoCMS
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidProjectFileException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Any idea how to solve this one? I use VS2012, .Net Framework 4.5, Nuget 2.8.6
Thanks to #JanR in the comment section disabled Resharper work for me. However when finish installing and try to run using F5 this error is happen.
Configuration Error :
<add name="UmbracoMembershipProvider" type="Umbraco.Web.Security.Providers.MembersMembershipProvider, Umbraco" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="8" useLegacyEncoding="true" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Member" passwordFormat="Hashed"/>
Any idea to solve this?
I have a solution having 1 project.
Open Package Manager Console, run Install-Package MSBuildTasks
But it gave me an error below:
Install-Package : The current environment doesn't have a solution open.
At line:1 char:16
+ Install-Package <<<< MSBuildTasks
+ CategoryInfo : InvalidOperation: (:) [Install-Package], InvalidOperationExcep
tion
+ FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PowerShell.Commands.InstallPackage
Command
I don't understand why it comes. Kindly suggest me waiting for reply. Thanks
I usually get this error because I created or opened a project (.csproj or other) that doesn't have a saved solution (.sln) associated with it.
If you go to File->Save All it should offer to save the solution somewhere. Save it and that makes the error go away for me.
I have a solution that uses NuGet to manage packages, and I also use the Package Manager Console for Entity Framework Migrations. Everything has worked fine for around a year.
This morning I removed a few projects from the solution as part of a reorganization. Now when I open the Package Manager Console, I am greeted with the error message
Set-DefaultScaffolder : Object reference not set to an instance of an object.
At E:\Dev\survey\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1:50 char:9
+ Set-DefaultScaffolder -Name CustomTemplate -Scaffolder
T4Scaffolding.Cus ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], NullR
eferenceException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet
What is causing this, and how can I fix it?
I installed Visual Studio 2012 SP2 a day or so after posting this issue, and it resolved itself.
Unsure whether SP2 fixed the underlying issue or just reset something, but either way the problem is resolved.
I am trying to debug T4Scaffolding.Core Nuget package from outside Visual Studio 2012.
I am using Powershell ISE with Powershell 3.0 installed and run under CLRVersion 4.0.30319.
I first import several Nuget related items:
- Profile.ps1
- nuget.psm1
- NuGet.Cmdlets.dll
I am also setting the current location to set-location "\ClassLibrary1\"
and obtained the only DTE instance currently running (I previously opened MySolution in VS 2012 that has a class library and an asp.net MVC 4 application in it)
$dte = [runtime.interopservices.marshal]::GetActiveObject("visualstudio.dte")
I skipped importing Get-Project cmdlet from NuGet.Cmdlets.dll binary module, so I can create my own cmdlets: Get-Project
that gets my MVC project this way:
$project = $dte.Solution.Projects.Item("MvcApplication1\MvcApplication1.csproj")
I am able to step into init.ps1:
\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1
but the code fails when executing:
Set-DefaultScaffolder -Name CustomTemplate -Scaffolder T4Scaffolding.CustomTemplate -SolutionWide -DoNotOverwriteExistingSetting
Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
At line:1 char:1
+ Set-DefaultScaffolder -Name CustomTemplate -Scaffolder T4Scaffolding.CustomTempl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], InvalidOperationException
+ FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet
I also tried pointing to my $project name (omitting -SolutionWide) with the same results.:
Set-DefaultScaffolder -Name CustomTemplate -Scaffolder T4Scaffolding.CustomTemplate -Project ($project).Name -DoNotOverwriteExistingSetting
I could observe that EnvDTE.dll is loaded into Powershell ISE environment by using:
[System.Threading.Thread]::GetDomain().GetAssemblies()
Hopefully someone will be interested in achieving the same goal (stepping line by line through init.ps1 and install.ps1 of a Nuget package outside Visual Studio).
Thanks,
Rad
Stack Overflow: question I used as a starting point
I got same error message:
Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE
but in different scenario. I was using scaffold in VS2015, installed T4Scaffolding.Core. Then I found the solution from this link
By installing Windows Management Framework 4.0 the error is gone and my scaffold works again.
Hopes this can help.