Trying to use "dotnet ef" command in Package Manager Console.
the PMC is cd to the .csproj directory, and still getting:
dotnet : Specify which project file to use because this 'C:\Users\PC-NAME\Source\Repos\TestProject\Test" contains more than one project file.
At line:1 char:1
dotnet ef migrations add TestMigration
+ CategoryInfo : NotSpecified: (Specify which p...e project file.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Tried use -p / --p and point to the .csproj file / directory - still same error.
Using .NET CORE, MVC project, Latest EF Core 2.0.2 version.
There's no so much valuable data
on the internet about that problem, just a wild guess
that dotnet ef command is looking for .exe file to run on.
Hoping for help.
If your project contains more than one .csproj file you should move them to another directory other than the project folder and run again your commande line.
In my case I have two .csproj in the project folder : CoreWebApplication.csproj and CoreWebApplication-backup.csproj so I moved the CoreWebApplication-backup.csproj and I kept the CoreWebApplication.csproj
dotnet ef ... -p CoreWebApplication.csproj -s CoreWebApplication.csproj
You need to specify your startup project and your data project using --startup-project and -p respectively.
dotnet ef migrations add TestMigration -p <path-to-your-project-with-your-db-context>.csproj --startup-project <path-to-your-project-with-your-program.cs>.csproj
You'll need to specify both -p and -s:
dotnet ef ... -p ThisOne.csproj -s ThisOne.csproj
where
-p --project <PROJECT> The project to use.
-s --startup-project <PROJECT> The startup project to use.
EF Core .NET Command-line Tools
Related
Goal
I am using Docker to run JMeter in Azure Devops. I am trying to use Blazemeter's Parallel Controller, which is not native to JMeter. So, according to the justb4/jmeter image documentation, I used the following command to get the image going and run the JMeter test:
docker run --name jmetertest -i -v /home/vsts/work/1/s/plugins:/plugins -v $ROOTPATH:/test -w /test justb4/jmeter ${#:2}
Error
However, it produces the following error while trying to accommodate for the plugin (I know the plugin makes the difference due to testing without the plugin):
cp: can't create '/test/lib/ext': No such file or directory
As far as I understand, this is an error produced when one of the parent directories of the directory you are trying to make does not exist. Is there something I am doing wrong, or is there actually something wrong with the image?
References
For reference, I will include links to the image documentation and the repository.
Image: https://hub.docker.com/r/justb4/jmeter
Repository: https://github.com/justb4/docker-jmeter
Looking into the Dockerfile:
ENV JMETER_HOME /opt/apache-jmeter-${JMETER_VERSION}
Looking into entrypoint.sh
if [ -d /plugins ]
then
for plugin in /plugins/*.jar; do
cp $plugin $(pwd)/lib/ext
done;
fi
It basically copies the plugins from /plugins folder (if it is present) to /lib/ext folder relative to current working directory
I don't know why did you add this stanza -w /test to your command line but it explicitly "tells" the container that local working directory is /test, not /opt/apache-jmeter-xxxx, that's why the script is failing to copy the files.
In general I don't think that the approach is very valid because:
In Azure DevOps you won't have your "local" folder (unless you want to add plugins binaries under the version control system)
Some JMeter Plugins have other .jars as the dependencies so when you're installing the plugin you should:
put the plugin itself under /lib/ext folder of your JMeter installation
put the plugin dependencies under /lib folder of your JMeter installation
So I would recommend amending the Dockerfile, download JMeter Plugins Manager and installed the plugin(s) you need from the command line
Something like:
RUN wget https://jmeter-plugins.org/get/ -O /opt/apache-jmeter-${JMETER_VERSION}/lib/ext/jmeter-plugins-manager.jar
RUN wget https://repo1.maven.org/maven2/kg/apc/cmdrunner/2.2/cmdrunner-2.2.jar -P /opt/apache-jmeter-${JMETER_VERSION}/lib/
RUN java -cp /opt/apache-jmeter-${JMETER_VERSION}/lib/ext/jmeter-plugins-manager.jar org.jmeterplugins.repository.PluginManagerCMDInstaller
RUN /opt/apache-jmeter-${JMETER_VERSION}/bin/./PluginsManagerCMD.sh install bzm-parallel
I am trying to update a soap service reference using svcutil.
I have tried:
dotnet svcutil -u --projectFile "C:\projects\MySolution\MyProject\MyProject.csproj"
Which gives the nonsensical error:
Warning: The specified --projectFile option is not expected in the current operational context of the tool!
Error: The --update option requires a project to be specified, please use the --projectFile option to specify the project to use.
And:
dotnet svcutil -u --projectFile "C:\projects\MySolution\MyProject\MyServiceFolder"
Same Error
And I have tried:
dotnet svcutil -u --projectFile "C:\projects\MySolution\MyProject\MyServiceFolder\dotnet-svcutil.params.json"
Same error.
I have even tried:
dotnet svcutil -u "C:\projects\MySolution\MyProject\Nexus.Services.csproj"
and
dotnet svcutil -u "C:\projects\MySolution\MyProject\MyServiceFolder"
But that gives the error:
Error: The --update option requires a project to be specified, please use the --projectFile option to specify the project to use.
I cannot find a single example anywhere of how this command should be run.
Has anyone gotten this to work?
To update a service reference using dotnet svcutil --update ..., it needs to find both the project file and the service reference configuration.
From the help dotnet-svcutil --help:
--projectFile <project file> The project file to add the client to (if any). (Short Form: -pf).
--update <web service reference> Updates an existing web service reference. If the project contains more than one web service reference, the name of the web service reference to be updated is required. (Short Form: -u).
When you run the svcutil in a different directory than the one containing your project file, you will need to tell it explicitly where your project is using --projectFile.
So, the easiest solution is to run the update command from the directory containing your project and specify where the service reference is:
dotnet svcutil -u .\path\to\ServiceReference
You can specify the path of the directory containig the dotnet-svcutil.params.json file, or an explicit path to a config file.
From the examples printed when running dotnet svcutil -h:
dotnet-svcutil -u ServiceReference
Update existing web service reference named ServiceReference. The command need to be executed under directory which contains the project file.
Dockerfile is failing on the following line:
ADD ./test-web-app/build/libs/test-web*.war /app/test-web.war
Error Step 8/29 : COPY ./test-web-app/build/libs/test-web*.war
/app/micro-service.war No source files were specified
This is the first time I am working on Docker builds. How do I debug this issue? Is there a way to echo if the host file is existing by a command ?
be sure that the path of the file is accessible where the Dockerfile is. When you run the build, the . folder is where the Dockerfile is. So you directory structure has to be something similar to this:
.
..
Dockerfile
test-web-app (folder)
To be sure that the war file is accessible try to list the file (on your host machine) for example.
$ ls ./test-web-app/build/libs/test-web*.war
Following all .NET Core guides basically boils down to a dotnet publish and copying the output of that to /app, then running dotnet myapp.dll.
I have about 40+ (and growing) products running in this setup, and so modifying all dockerfiles with myapp.dll gets quite laborious.
I was wondering if there is some way to find out what the entry dll is during publish? (e.g. with --self-contained the cli generates an arch specific entry file, so you can use that name, but it seems like an unnecessary step given that publish takes longer)
You can create a bash script which will extract project name, and next create a valid path with replacing it in script file.
If you are in solution folder just run: (bash)
PROJECT_NAME=`find ./ -name "*.sln" | head -n 1 | cut -d '/' -f 2 | sed 's/.sln//'`
If you have solution file myapp.sln , this command will return value myapp
Then you pass this value to script:
./runScript.sh "$PROJECT_NAME"
And inside this script:
dotnet "/app/$1.dll"
For dockerfiles you have replace all occurences of eg. {{PROJECT_NAME}} in file to value of variable. Now i don't remember command, but sed is useful for that.
I'm trying to configure running simple .NET Core Web API application inside Docker container. My dockerfile contains following ENTRYPOINT line:
ENTRYPOINT ["dotnet", "Project.name.dll"]
Dockerfile builds image proper. When I run it however I have following exception:
No executable found matching command "dotnet-Project.name.dll"
I don't understand why parameter is transformed in that way (added hyphen). I use microsoft/dotnet:2.0.0-sdk-stretch container. Official documentation recommends following ENTRYPOINT config
ENTRYPOINT ["dotnet", "dotnetapp.dll"]
Which is the same as I use...
It's a bizarre error message, but it really is saying that the dll can not be found. You can see other examples of this "issue" here: https://github.com/dotnet/core-setup/issues/1126#issuecomment-327441394
When you run dotnet foo.dll, the dotnet application tries to find foo.dll and execute it. If the dll is not found, dotnet thinks that maybe you are trying to run a dotnet command (along the lines of dotnet foo, similar to dotnet build). This makes dotnet look for an executible named dotnet-foo.dll and try and execute that. Since that file also doesn't exist, dotnet finally errors out that dotnet-foo.dll can not be found.
In your case, it looks like dotnet couldn't find Project.name.dll. Does the dll really exist? Does it exist in the current directory? Perhaps you need to provide the full path to it?
Oh, and if you are running this on Azure, there are some known gotchas, such as putting your dlls under /home/ will just not work.