Getting the following error on TravisCI when trying to build an ASP.NET Core WebApp.
Could not find project file
/usr/lib/mono/xbuild/Microsoft/VisualStudio/v14.0/DotNet/Microsoft.DotNet.Props,
to import. Ignoring.
Builds on AppVeyor. Is there any way to install the missing file?
Note that I'm new to Travis CI so please include a reference (eg. link/step by step/guide) on how to implement your suggestion, thank you.
After trial and error we've came up with this:
Put these files into the root of your repo https://github.com/aspnet/KoreBuild/tree/1.0.0/template
Copy .travis.yml from a aspnet project e.g. https://github.com/aspnet/EntityFramework/blob/dev/.travis.yml
Remove parts you don't want, like branches and notifications
Make sure your solution and global.json is in the same directory as build.sh
I haven't found any documentation for it, so if it doesn't do what you want, you can just let it install dotnet and do what you want with commands yourself (e.g. dotnet publish)
Old answer:
If you don't solve the problem with xbuild, you can try using dotnet
cli. The install script for RTM is here:
https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.sh
Then you use dotnet restore and dotnet build (cd to directory with
project.json)
Change your .travis.yml to this:
language: csharp
install: curl -s https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.sh
| bash
script:
- dotnet restore WebApp/src/WebApp/project.json
- dotnet build WebApp/src/WebApp/project.json
addons:
apt:
packages:
- gettext
- libcurl4-openssl-dev
- libicu-dev
- libssl-dev
- libunwind8
- zlib1g
I'm not sure all of the apt packages are necessary. source:
http://andrewlock.net/adding-travis-ci-to-a-net-core-app/
It's also possible to use KoreBuild
https://github.com/aspnet/KoreBuild/tree/1.0.0/template
script: ./build.sh //Add the file to repo
Related
I am trying to generate drivers from the command ..
dotnet aspnet-codegenerator controller -name EmployeeController -m Employee -dc EmsContext --relativeFolderPath Controllers --useDefaultLayout --referenceScriptLibraries
Attempting to figure out the EntityFramework metadata for the model and DbContext: 'Employee'
A file matching the name MvcControllerWithContext.cshtml was not found within any of the folders:
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
It is the last step according to a documentation, I am starting with this Framework but I cannot get out of this status. I am using Ubuntu and all through the terminal. If someone can give me an indication of how to solve it, I would really appreciate it.
As #ericc-eacs Answer, you need to copy the template and in case you just following the getting started tutorial(.net core), make sure to remove the folder to the template of identity as when you build it will give some errors. You just need the templates to create the views and controllers.
What version of the dotnetcore SDK are you using?
dotnet --version
You may need to install a different version of the aspnet-codegenerator.
Some helpful commands:
dotnet tool uninstall --global dotnet-aspnet-codegenerator
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.0
dotnet tool update -g dotnet-aspnet-codegenerator
I have the solution for UBUNTU valid for net core 3.0, 3.1, and 5.0.
27/NOVEMBER/2020
ControllerGenerator contains de file MvcControllerWithContext.cshtml
You just copy the Templates folders Template/ControllerGenerator and Template/ViewGenerator to own project.
Look the version in this example is 5.0.0enter image description here
This is the path of the missing files: /home/$USER/.nuget/packages/microsoft.visualstudio.web.codegenerators.mvc/5.0.0/Templates
I can confirm that this issue exists at least since november and have not found solution for it. Using Ubuntu 18.04.5 LTS, Rider EAP 2020.3. C# 9, dotnet-aspnet-codegenerator version '5.0.1', dotnet 5.0.102.
When running the utility to build crud pages for Razor Pages web app:
dotnet aspnet-codegenerator razorpage -m GpsSession -dc ApplicationDbContext -udl -outDir Pages/GpsSessions --referenceScriptLibraries
The following output is given:
Building project ...
Finding the generator 'razorpage'...
Running the generator 'razorpage'...
Attempting to figure out the EntityFramework metadata for the model and DbContext: 'GpsSession'
A file matching the name Create.cshtml was not found within any of the folders:
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
When I run the same command on same repository in Win10 then everything works perfectly, crud pages are generated without any errors.
I am building a dotnet core tool and I am having trouble installing it globally. I can replicate the problem I am having but don't know how to fix it. Below are my steps
dotnet new console -o testconsole
Modify testconsole.csproj to include <PackAsTool> and <PackageOutputPath>
testconsole.csproj
dotnet restore testconsole.csproj
dotnet build testconsole.csproj
dotnet pack testconsole.csproj
dotnet tool install -g -v d --add-source ./nupkg testconsole
When installing I receive the below error
error NU1212: Invalid project-package combination for TestConsole 1.0.9. DotnetToolReference project style can only contain references of the DotnetTool type
install error
Here is a copy of testconsole.nuspec from the nupkg that includes
<packageType name="DotnetTool" /> per the suggestion from https://natemcmaster.com/blog/2018/05/12/dotnet-global-tools/
testconsole.nupsec
After finding the root cause, this error is hilarious, but also an indication of systematic issue.
Do you see this part of the warning in your output?
Package 'TestConsole 1.0.9' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project
What is this version 1.0.9? Where is .NET Framework 4.6.1 coming from? There's nothing like that in the .NET Core SDK (I looked through the sources) or under the testconsole directory on my disk.
Lets reduce the logging verbosity and re-run out install command:
$ dotnet tool install -g -v n --add-source ./nupkg testconsole
Build started 2018-09-26 7:16:47 p.m..
1>Project "/tmp/q2whkgqf.tbt/restore.csproj" on node 1 (Restore target(s)).
1>Restore:
Restoring packages for /tmp/q2whkgqf.tbt/restore.csproj...
CACHE https://api.nuget.org/v3-flatcontainer/testconsole/index.json
CACHE https://api.nuget.org/v3-flatcontainer/testconsole/1.0.9/testconsole.1.0.9.nupkg
Installing TestConsole 1.0.9.0.
Look at the last few lines carefully. dotnet tool install is trying to install https://www.nuget.org/packages/TestConsole/. Not your local testconsole nuget package!
You can work around it in a couple of ways:
Give your tools a really unique name that doesn't clash with anything on nuget.org or in your organization's nuget feed.
Add a nuget.config that <clear/>s the nuget feeds so only the ./nupkg directory is used as feed when looking to install testconsole.
Building on Omair's answer, the practical steps to solving this problem:
1. Create disable_nuget.config to disable reading from the global feed
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<disabledPackageSources>
<add key="nuget.org" value="true" />
</disabledPackageSources>
</configuration>
note: give it a special name so that it doesn't get picked up by nuget by accident when you don't want it to
2. Install the tool referencing the special nuget configuration
dotnet pack
dotnet tool install --global --configfile disable_nuget.config --add-source ./nupkg TestConsole
I am following Julie Lerman's Getting Started with Entity Framework Core 2.0 tutorial. I have installed Microsoft.EntityFrameworkCore.SqlServer Version 2.0.2. When I try to run add-migration initial (Package Manager Console) in VS 2017 I am obtaining the below error :
System.IO.FileLoadException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Microsoft.EntityFrameworkCore.SqlServer, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
When I run dotnet --version i get 2.1.3. Can anybody help me rectify this error.
Screenshot :
Thanks in Advance.
Following the very same Pluralsight video, I ran into this same problem. After running:
PM> install-package Microsoft.EntityFrameworkCore.SqlServer
with the default project set to SomeUI
I was able to get the add-migration initial to run without any problems at all, after doing so.
I know the following is not an exact answer to my own question. But rather than waiting to somebody answer how to solve it in VS 2017 ( Windows ) I am taking a Terminal Approach on my Mac and using dotnet cli to recreate the solution (Julie Lerman hope you won't send your favorite Samurai for a battle :P)
Note: Steps below is for Mac. Windows users having SQl Server Installed can Skip Step 1.
Step 1 : Install Docker and Pull MSSQL Image
a. Install docker and pull latest mssql image for linux using :
sudo docker pull microsoft/mssql-server-linux
b. Start the docker image using :
sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=
<ComplexPassword>' -p 1433:1433 -d microsoft/mssql-server-linux
c. Optional. Install sql-cli using npm install -g sql-cli. Now you can connect to Sql Server running on Docker using mssql -s 127.0.0.1 -u sa -p.
Step 2 : Create .sln, .csproj and add references using dotnet cli
Create directory for Project and under it create a .sln file using: dotnet new sln -n SamuraiApp
Create Data and Domain class Library Projects using : dotnet new classlib -n SamuraiApp.Data and dotnet new classlib -n SamuraiApp.Domain
Create and Empty ASP.NET Core Project using dotnet new web -n SamuraiApp.UI
Add Entity Frmaework Core to Data ClassLibrary using : cd SamuraiApp.Data and dotnet add package Microsoft.EntityFrameworkCore.SqlServer
Add Entity Framework Core Design to UI Project Using : cd SamuraiApp.UI/ and dotnet add package Microsoft.EntityFrameworkCore.Design
Run dotnet restore
Step 3: Add References
Execute dotnet add SamuraiApp.Data reference SamuraiApp.Domain/SamuraiApp.Domain.csproj to add Domain as a reference to Data.
Execute dotnet add SamuraiApp.UI reference SamuraiApp.Domain/SamuraiApp.Domain.csproj to add Domain as reference to UI.
Execute dotnet add SamuraiApp.UI reference SamuraiApp.Data/SamuraiApp.Data.csproj to add Data as reference to UI.
Execute below commands to add all three projects to solution:
dotnet sln add SamuraiApp.Data/SamuraiApp.Data.csproj
dotnet sln add SamuraiApp.Domain/SamuraiApp.Domain.csproj
dotnet sln add SamuraiApp.UI/SamuraiApp.UI.csproj
Open SamuraiApp.Data.csproj in your favorite text editor and add the following:
<ItemGroup>
<DotNetCliToolReference
Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
</ItemGroup>
To enable dotnet ef.
Step 4 : Write Domain Classes, DataContext class and add migration
cd into SamuraiApp.Data folder and execute the below command to add initial migration:
dotnet ef migrations add Initial --startup-project ../SamuraiApp.UI
Hope it helps to somebody. But still In windows using VS 2017 I am facing issues and would hope somebody will help me solve it.
Thanks :)
Some weeks ago, I followed this tutorial to get started with dotnet core + vue.js.
The steps to install the template were:
Install the SPA (Single Page Application) templates provided by Microsoft:
dotnet new --install Microsoft.AspNetCore.SpaTemplates::*
To get started and create a new Vue project, simply run the following commands on the console:
mkdir new-project
cd new-project
dotnet new vue
It worked perfectly (I repeat: that was some weeks ago).
Now I've repeated the same steps in the same machine and it says "There are no templates that match the name of the input template: vue" =>
Have the vue.js template been discontinued during the last weeks? Or am I doing something wrong?
After other comments saying it was working for them, and knowing that it worked for me some weeks ago, I've finally figured out what is going on:
On my "Available package sources" (NuGet config) in VS2017, I had the nuget nuget repository from work [work-repo]. I have to connect via VPN to be able to access it (and I wasn't during my tests). I didn't have it connected some weeks ago when the whole process worked perfectly.
Now, when I was executing dotnet new --install Microsoft.AspNetCore.SpaTemplates::*, the first lines were informing me that "I am not able to connect o [work-repo]". But then it seemed to continue as if nothing happened, and I ignored it because I didn't see it as something that would have anything to do with "not seeing vue".
Once I removed [work-repo] from the sources list, I have been able to see the "vue" template again. I have installed it via dotnet new vue and it works perfectly.
tl;dr: If you have "Nuget package sources" that are not accessible at the moment, the process "Install the SPA templates provided by Microsoft" doesn't work.
I had the same issue. In my case, the issue occured after installing Visual Studio 2019. After struggling for a while I found out that
the NuGet V2 package source was completely missing.
After going to Tools -> Options -> NuGet Package Manager -> Package Sources, adding https://www.nuget.org/api/v2/, the vue-template appreared after running that command:
dotnet new --install Microsoft.AspNetCore.SpaTemplates::*
I similarly found this wasn't working, and the problem was also having a private repository (that needed authentication rather than being completely inaccessible). The simplest solution for me was to list the nuget packages using 'nuget sources', check the name of the private repository, use 'nuget sources Disable -Name [privatereponame]' to temporarily disable the repo, then run 'dotnet new --install Microsoft.AspNetCore.SpaTemplates::*' to install the new templates, and finally 'nuget sources Enable -Name [privatereponame]' to re-enable the private repo that was causing the problem.
I had the same problem and it was Telerik source/package causing the issue. Once I removed iy from the "Available package sources" (just like Xavier suggests), the SpaTemplates install completed without error
Its so simple: just run
dotnet new search vue
then follow the instruction
and then select a template, enjoy
I am trying to set up my Ubuntu machine for dotnet core development. I've painstakingly installed Omnisharp-vim and set it to work with the OmniSharp-Roslyn server. I also have Syntastic and YouCompleteMe installed. I am getting syntax checking and Intellisense. I have two problems though:
Omnisharp-vim does not work without a solution file. Dotnet core projects don't have to have solutions files. How do I get around this?
I am getting syntax error for valid C# 6 code. For instance, it does not recognize the nameof operator.
How?
Add a valid global.json file to your root directory.
{}
Add two lines to the top of your vimrc file.
let g:OmniSharp_server_type = 'roslyn'
let g:OmniSharp_prefer_global_sln = 1
Why?
Those two OmniSharp settings tell omnisharp-vim to use Roslyn and to use the directory that contains a global.json file.
Here is the OmniSharp.vim file source-code that uses those variables.
if g:OmniSharp_server_type ==# 'roslyn' && g:OmniSharp_prefer_global_sln
let global_solution_files = s:globpath(dir, 'global.json')
call filter(global_solution_files, 'filereadable(v:val)')
if !empty(global_solution_files)
let solution_files = [dir]
break
endif
endif
If that does not work...
Try starting OmniSharp manually from the command line:
omnisharp-vim\omnisharp-roslyn\artifacts\scripts\OmniSharp.cmd -s C:\temp\
The C:\temp\ directory contains a new .NET Core project with a valid global.json file.