I am trying to follow the tutorial http://www.asp.net/web-forms/tutorials/data-access/model-binding/retrieving-data.
When I am trying the update-database command in PM console, i get the following error.
Cannot attach the file 'D:\ASPdotNet\ContosoUniversity\ContosoUniversity\App_Data\ContosoUniversity.Models.SchoolContext.mdf' as database 'ContosoUniversity.Models.SchoolContext'.
Just ran into the exact same issue. To resolve I used,
Open the "Developer Command Propmpt for VisualStudio" under your start/programs menu and
run the following commands:
sqllocaldb.exe stop v11.0
sqllocaldb.exe delete v11.0
Rebuild the solution and try to update the database again.
Related
I am getting an error when attempting to create a user. I have Airflow running on Unbunto Virtualbox and I am SSH from Visual Studio Code. As a sanity test, I ran airflow scheduler and got a "command not found" again. Attempted to run the command with sudo as well.
Turns out if you are working in the sandbox and close out virtual studio code you need to get back in the sandbox and then run the commands.
>source sandbox/bin/activate
>airflow db init
>airflowebserver
From Symfony 4, I am on (migration) version 20190708084642 and the only next version is 20190708121109 (I generated a Migration file named "Version20190708121109.php")
If I execute the command ./bin/console doctrine:migrations:migrate, I get this SQL error :
because the ./bin/console doctrine:migrations:migrate command run a old migration file. Why this command execute an old migration file ? (the 20190701095432)
Is it normal ?
EDIT : in my database, my current migration version is 20190708084642, I see this same current version also when I execute the command ./bin/console doctrine:migrations:status
i don't know if this will solving your problem, but, in my case, i change my sql from phpMyAdmin to MySql 5.7. and my problem is done
I'm' trying to execute a post build event that builds a nuget package based on a .nuspec file. I'm using Visual Studio 2013. My post build event command line is:
nuget pack $(ProjectPath) -Symbols -Properties Configuration=$(ConfigurationName) -IncludeReferencedProjects
When I build my project, I get the following error:
The command "nuget pack C:\Users\user\Documebts\Code\BookProject\BookProject.Nuget\
BookProject.Nuget.csproj -Symbols -Properties Configuration=Debug
-IncludeReferencedProjects" exited with code 1.
I'm not sure what's going on - I changed the Visual Studio build output to Diagnostic and found this:
>Using 'BookProject.nuspec' for metadata. (TaskId:44)
>Access to the path 'C:\BookProject.1.0.3.4.nupkg' is denied. (TaskId:44)
>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: The command "nuget pack C:\Users\user\Documebts\Code\BookProject\BookProject.Nuget\ BookProject.Nuget.csproj -Symbols -Properties Configuration=Debug -IncludeReferencedProjects" exited with code 1.
>Done executing task "Exec" -- FAILED. (TaskId:44)
>Done building target "PostBuildEvent" in project "Miw.Mshdf.Net.Nuget.csproj" -- FAILED.: (TargetId:72)
If I open up a command prompt and type in the post build event command, it works fine and builds the nuget package without any problems. Any ideas?
According to the error code, your problem should be related to the access permission for the path "C:\". Please run your Visual Studio as administrator to make sure it has enough permissions to do any operations.
And make sure your current Windows user also has enough permissions to access the "C:\".
The work around i used is
1. Right click on solution -> manage nuget package for solution
2. On top there is text "install missing packages" -> click restore
3. Also i manually given the package sources in -tools ->Nuget package manager ->
package sources
4. run VS 2013 in administrator mode and gave permission to the required folders
first of all I would like to say that I'm relatively new to symfony and I work with Netbeans.
My first problem occurs when I'm trying to install ccdn-forum-bundle like it's said here:
https://github.com/codeconsortium/CCDNForumForumBundle/blob/master/Resources/doc/install.md
When I try to update-dev with composer I get this error:
[RuntimeException]
Failed to execute git status --porcelain --untracked-files=no
"git" is not recognized as an internal or external command, operable program or batch file.
It occurs when composer is trying to update friendsofsymfony/user-bundle and when I try to run my project I get this error from symfony:
ClassNotFoundException: Attempted to load class "MonologBundle" from namespace "Symfony\Bundle\MonologBundle" in C:\xampp\htdocs\PortalInternoHUPR\app\AppKernel.php line 14. Do you need to "use" it from another namespace?
I tryed to fix it by running install dev in composer, but then I get this other one:
Fatal error: Class 'Knp\Bundle\PaginatorBundle\KnpPaginatorBundle' not found in C:\xampp\htdocs\MyProject\app\AppKernel.php on line 23
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the ""cache:clear --no-warmup"" command.
Thanks.
Try not to use netbeans, and install the bundle directly from the prompt
First check if git is correctly installed
git –version
Then run
php composer.phar update
If that didn’t work for you, I suggest making a fresh install using --prefer-dist option
php composer.phar install --prefer-dist
I am trying to install Symfony 2.1.3 (latest). I am running composer and installs everything okay. The only error that I get is:
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
It's being installed under www folder. I am running nginx and followed the composer approach. I read on internet that apache should be run manually not as a service, however I am using nginx instead. Does apache still have any bearing on it? I'm using debian squeeze.
Edit: As per AdrienBrault's suggestion the error was because the timezone was not set in the php.ini. Only with --verbose I could see the warning. Thanks guys.
Apache is not related - PHP is called via command line.
Most likely is the permission in the cache folder: did you check if the user that runs the composer update can actually write the cache folder?
Try to manually run rm -Rf app/cache/dev (for production environment replace dev with prod) and see if you get any permission error.
Also you will get this error if the default.timezone setting is not configured in php when running in CLI. To verify just run
php --info | grep timezone
and check that the setting date.timezone is correctly configured.
On the security side, setting 777 to the folder is not the optimal solution - if you have ACL enabled you could use that to correctly set up the permission for the cache and logs folder. Read more at the Symfony2 official installation page
I had this same issue for a while and after hours of face to brick wall pounding I realized... I have a .gitmodule in my project, and on initial checkout these submodules are NOT initialized and as such are not there for your composer to update, which results in the above error.
Make sure you run the following
git submodule update --init src/Acme/Sadness/Bundle
of course replace src/Acme/Sadness/Bundle with YOUR project namespace.
Hope this helps someone not go through the same pain I just did.
If you have vendor folder already I would remove it and install symfony 2.1.3 again via "composer.phar install". Problem might be coming from outdated version of composer
I had the same problem and I resolve in this way.
execute this on the console
and you should see something like this
$ locate php.ini
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
/etc/php5/fpm/php.ini
the first line is probably your php.ini that appear when you do a phpinfo();
the problem is that when you execute composer update this no check the same php.ini
in my case the second line
all my sites work fine but always I had problems not now
after edit the second file and put the same time zone that you set in the first one
run
$ sudo service apache2 reload
and now
$ composer update
I hope that this work for you like work for me
regards
Emiliano