Two output file names resolved to the same output path migration.init in mvc - asp.net-mvc

I am working in MVC and running with this problem "Two output file names resolved to the same output path '..\migration.init.resources'"
At first i run this command "Enable-Migrations" successfully after making changes in code i run "Add-Migration init" in console an error occur " project failed to build" with "Two output file names resolved to the same output path '..\migration.init.resources'"
I have deleted all migration.resouces files from obj folder, unload, reload and also restart the project but all goes with same error

I faced the same issue and solved :
1. Delete the Migrations Folder
2. Delete the line of code which uses Migrations.Configuration Namespace in Global.asax.cs file
3. Use Code First Migration to generate the new Migrations file and Folder.

Related

PyCharm: Unit testing directory setup with remote interpreter

For years I've been running a Docker container on my local machine and using it as a remote Python interpreter via SSH in PyCharm. This works great (though 2022.2.1 brought a lot of new bugs that have been slowly being ironed out) for running my code! I'm now on 2022.2.3.
However, I'm having issues running unit tests. In the past (i.e. before version 2022.2.1), I could simply right click my tests directory (a direct child of my main project directory) and click Run Python tests in test... and it would all work as expected.
Now, though, when I click this, I receive an error message about "No such file or directory."
I've tried everything I can think of- I've setup my path mappings in the Python test run config to exactly match those shown in my Python run config, and have tried every version of directory and subdirectory in the mappings and working directory, but I always receive an error about either having an empty test suite (no tests found), or that the directory "must be in the project."
It seems like no matter what I do, PyCharm is trying to create a temp directory somewhere, or is trying to read from some temp directory that I never specified, because I see errors this like:
AssertionError: /tmp/pycharm_project_405/docker/tests: No such file or directory
Yet I never created, specified, or requested a temp directory of any sort, let alone one named /tmp/pycharm_project_405/; this is a mystery to me.
PyCharm with an SSH interpreter is rapidly becoming unusable for me and my team because we cannot figure out how to set this up. Can anybody please offer some guidance on what we need to do?
Thank you all so very much!
I tried:
Changing run config for Python tests to match the working directory and path mapping of Python run configs (which work)
Directly specifying the path to the tests from the container's perspective
Setting up run config templates
Specifying one directory up/down from the actual tests
Expected:
Unit tests to be found and run as they were in previous versions of PyCharm
Answer
Create a run config for testing
In the testing run config, set Target: to Custom
Set the correct remote interpreter
Set Working directory to the test folder
Set TWO path mappings: 1) Map the code directory (in my case, the parent directory of the tests folder) and 2) Map the test directory itself
Voila!!!

Ruby change directory in code

So, I've came across an issue where I delete the current folder where my ruby script is executing ex:
/home/user/scriptfolder
Now i have my ruby gem running and I do this:
mycommand --deletefull
now mycommand is an GLI command, which should delete the content of the folder and the folder itself. I do that by using my custom class:
ClientModuleDir.rm_f(path)
now after deleting it I want to just do cd ..
however I've tried several methods:
system('cd ..')
Dir.chdir(dir) #dir is abs path without the scripfolder name, i've tried every combination with this command, nothing works so far.
However these methods are not working.
I still am in the
/home/user/scriptfolder
after executing these commands, but the folder DOES NOT EXIST. When I manually do cd .. and i do ls the folder is not there.
How do I change "physically" the folder in ruby code ?
The current working directory is always kept for the current program only. Changing the working directory in a program won't affect any other running programs, including its parent.
Thus, when you delete the directory in your Ruby script and change the working directory of the Ruby process one level down, this won't affect the shell process which has started your Ruby script.

Pyinstaller adding data files

I'm struggling with pyinstaller. Whenever I build this specific script with a kivy GUI and a .kv file, and run the .exe after the build, I get a fatal error:
IOError: [Errno 2] No such file or directory: 'main.kv'
I've tried adding the .kv file, as well as a mdb and dsn file (for pypyodbc) using --add-data, but I get an error: unrecognized arguments: --add-data'main.kv'. (There were more --add-data arguments for the other files mentioned.)
Are there any solutions for this or maybe alternative methods?
As others (#Anson Chan, #schlimmchen) have said:
If you want to add some extra files, you should use Adding Data Files.
Two ways to implement
Command Line: add parameter to --add-data
Spec file: add parameter to datas=
Generated when running pyinstaller the first time.
Then later you can edit your *.spec file.
Then running pyinstaller will directly use your *.spec file.
Parameter Logic
Parameter in --add-data or datas=:
--add-data:
format: {source}{os_separator}{destination}
os_separator:
Windows: ;
Mac/Linux/Unix: :
source and destination
Logic:
source: path to single or multiple files, supporting glob syntax. Tells PyInstaller where to find the file(s).
destination
file or files: destination folder which will contain your source files at run time.
* NOTE: NOT the destination file name.
folder: destination folder path, which is RELATIVE to the destination root, NOT an absolute path.
Examples:
Single file: 'src/README.txt:.'
multiple files: '/mygame/sfx/*.mp3:sfx'
folder: '/mygame/data:data'
datas=
Format: list or tuple.
Examples: see the following.
added_files = [
( 'src/README.txt', '.' ),
( '/mygame/data', 'data' ),
( '/mygame/sfx/*.mp3', 'sfx' )
]
a = Analysis(...
datas = added_files,
...
)
Your case
For your (Windows OS) here is:
--add-data in command line
pyinstaller -F --add-data "main.kv;." yourtarget.py
OR:
datas= in yourtarget.spec file, see following:
a = Analysis(...
datas = ["main.kv", "."],
...
)
If you check pyinstaller -h for help, you can find --add-data option works like this [--add-data <SRC;DEST or SRC:DEST>]. So in your case try
pyinstaller -F --add-data "main.kv;main.kv" yourtarget.py
The solution is to run: pyi-makespec yourscript.py
Then edit the yourscript.spec script and add the files under datas in a= Analysis.
datas=[ ( '/pathToYourFile/main.kv', '.' )]
then run pyinstaller yourscript.spec
should be good after that.
Next -F or --onefile option is assumed when running pyinstaller.
Note that (MacOS Monterey, 12.2 here) the expected folder hierarchy w/in you .app file will be similar to this,
pyinstaller does not add files nor create necessary folders into any of the folders of this folder structure; at least not in any apparent way. You won't find them.
However, when the application runs, a temporary folder is used under /var/folders which is very different from the folder structure in point 1. above. print(os.path.dirname(__file__)) while running the application will reveal which exact temporary folder is used each time it runs. For convenience, let's call it my_app_tmp_folder i.e. your app runs under the folder /var/folder/my_app_tmp_folder
Then, pyinstaller adds data files or creates necessary directories w/in this temporary folder. In other words, when the application runs, all added files will be there and according to the specified folder structure (through --add-data option). print(os.listdir(os.path.dirname(__file__))) will show system and application needed files and folders.
Bottom line: Files specified w/ --add-data option will be visible w/in /var/folder/my_app_tmp_folder when running and not w/in the *.app folder.
Some useful links from documentation:
https://pyinstaller.readthedocs.io/en/stable/runtime-information.html#using-file
https://pyinstaller.readthedocs.io/en/stable/spec-files.html#adding-files-to-the-bundle
https://pyinstaller.readthedocs.io/en/stable/operating-mode.html#bundling-to-one-file
My application had this issue and a subsequent issue that is likely, if not inevitable.
1. --add-data for a kv file
Use --add-data as in the answer by crifan.
2. Kivy still can't find the file
Once PyInstaller has the kv file in the correct directory, Kivy still can't find the file.
Possible Symptoms:
GUI launches, but screen is black and empty.
An AttributeError error that depends on the application code.
AttributeError Examples:
This question
My own case:
AttributeError: 'NoneType' object has no attribute 'ids'
Fortunately, this answer solves the problem.

Cannot load angular.dart

During the reproduction of this example, something strange happend: https://github.com/dart-lang/dart_by_example/tree/master/example/angular/basics/conditionally_switch_between_dom_elements
So created a plain Dart project in WebStorm, added angular.dart, copied the example. Everything works well, if the files are "web" directory.
BUT, after I moved the three files into a switch subdirectory, I have the following problem:
An error occurred loading file: package:angular/angular.dart
Do you have any idea? What did I missed.
If you added the subdirectory after you ran pub get then it may not have the packages symlink folder. Try running pub get (from your apps root directory) again which should generate any missing packages in subdirectories that may have been added, without re-downloading any dependencies.

Re-sync folders via command line

I am currently working out how best to go about syncing files in my folders which will be included in my installer.
It works fine through the interface, but doesn't seem to work out well when doing it through the command line.
My folder structure is essentially:
Root
Installer Config
My code 1
My code 2
My installer is to set up my two code folders when installed. Like I mentioned, I have this set up working for building the installer through the interface.
In my project, I have My code 1 and My code 2 folders set as sync folders in the Files and Folders section.
In the Installer Config folder, I am running a couple of scripts which essentially boil down to a batch file which does:
"AdvancedInstaller.com" /loadpathvars PathVariables.xml
"AdvancedInstaller.com" /execute myproject.aip commands.txt
and my commands.txt which does:
;aic
ResetSync APPDIR\mycode1
ResetSync APPDIR\mycode2
Save
Rebuild
When the ResetSync calls are made, I get the error: Folder not synchronized: APPDIR\mycode1. but when I just hit refresh in the Files and Folders section in interface, it works fine.
To create this error I add a new file to the 'My code 1' folder. Run the scripts, and I get the 'Folder not synchronized' error.
Solved on Advanced Installer forums.

Resources