I have started ASP .NET vNext and I was going through several articles about using bower in Visual Studio 2015 for managing client side libraries, it's pretty simple to use but I am having problems in updating the packages...
I am following this
bower.json:
"dependencies": {
"bootstrap": "3.3.2",
"jquery": "1.4.1",
"jquery-validation": "1.11.1",
"jquery-validation-unobtrusive": "3.2.2",
"hammer.js": "2.0.4",
"bootstrap-touch-carousel": "0.8.0",
"jquery-migrate-official": "^1.2.1",
"bootstrap-hover-dropdown": "2.1.3",
"jquery-slimscroll": "1.3.3",
"jquery-cookie": "1.4.1",
"jquery.uniform": "4.3.0",
"blockui": "2.1.2",
"font-awesome": "4.3.0"
},
The intellisense says that the package blockui has the latest stable version 2.1.2 but package manager log says:
bower blockui#2.1.2 ENORESTARGET No tag found that was able to satisfy 2.1.2
bower blockui#2.1.2 not-cached git://github.com/malsup/blockui.git#2.1.2
bower blockui#2.1.2 resolve git://github.com/malsup/blockui.git#2.1.
Questions:
What does this mean? Is the intellisense picking up the wrong latest version?
Is there any better way to update all client side packages like I used to do using nuget package manager ?
update-package
I read that for server-side packages ASP .NET vNext will use nuget packages but when I write any command in my Package Manager Console nothing happens
update-package
install-package entityframework
You can right-click the 'Bower' node under the 'Dependencies' node and choose 'Restore Packages'. I often have to open the 'Task Runner Explorer' from 'View -> Other Windows' and run the 'bower' task from its context menu. This will trigger a bower installation.
gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
bower: {
install: {
options: {
targetDir: "wwwroot/lib",
layout: "byComponent",
cleanTargetDir: false
}
}
}
});
// This command registers the default task which will install bower packages into wwwroot/lib
grunt.registerTask("default", ["bower:install"]);
// The following line loads the grunt plugins.
// This line needs to be at the end of this this file.
grunt.loadNpmTasks("grunt-bower-task");
};
package.json
{
"version": "0.0.0",
"name": "",
"devDependencies": {
"grunt": "0.4.5",
"grunt-bower-task": "0.4.0"
}
}
The packages should then show up in your wwwroot -> lib directory.
Check out bower's website for more details: http://bower.io/
I just found that for (and for font-awesome package) IntelliSense advices non-existing version. That was 2.1.2, exactly like for your case, that is why I found your question.
I had re-checked real version, corrected it to existing one, and everything started to work.
Related
I'm trying to set up grunt-sass for the first time on a new .Net Core 3.1 web app. I've gone through MSFT's steps to add grunt to a project here outlined here and then modified it with the steps from the grunt-sass instructions here.
This however causes task runner explorer to state there are no tasks found.
Here is my package.json:
{
"name": "chapelstudios_www",
"version": "0.0.2",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://me#bitbucket.org/me/chapelstudios_www.git"
},
"author": "mr",
"license": "ISC",
"homepage": "https://bitbucket.org/me/chapelstudios_www#readme",
"private": true,
"devDependencies": {
"grunt": "^1.0.4",
"grunt-cli": "^1.3.2",
"grunt-sass": "^3.1.0",
"node-sass": "^4.13.1"
},
"dependencies": {
"gulp": "^4.0.2"
}
}
And this is my gruntfile.js:
const sass = require('node-sass');
require('load-grunt-tasks')(grunt);
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Sass
sass: {
options: {
implementation: sass,
sourceMap: true, // Create source map
outputStyle: 'compressed' // Minify output
},
dist: {
files: [
{
expand: true, // Recursive
cwd: "Styles", // The startup directory
src: ["**/*.scss"], // Source files
dest: "wwwroot/css", // Destination
ext: ".css" // File extension
}
]
}
}
});
// Load the plugin
grunt.loadNpmTasks('grunt-sass');
// Default task(s).
grunt.registerTask('default', ['sass']);
};
I'm not sure how to get any more detailed error info then that but have tracked down the issue to the
const sass = require('node-sass');
line that is required by the grunt-sass instructions. If I change it to the string 'sass' that is recommended by older tutorials the task shows but fails when I attempt to actually run it.
I've also ran the following installations from an elevated powershell window in the project directory in an attempt to make sure they were installed into the project locally as I hear that to be a main issue:
npm install
npm install grunt
npm install grunt-cli
npm install --save-dev node-sass grunt-sass
At this point I'm out of ideas but I'm a newb so I'm sure I'm missing something obvious.
For anyone else visiting this with an existing project, I was having this issue with a pre-existing node-sass / grunt file on a new computer, and I found that bumping up the version of node-sass in my package.json caused VS to reinstall the packages and update the bindings as noted in the other answer.
I have a slight suspicion that there's a difference in versions between running grunt in my command prompt and whatever VS uses, since my grunt file worked just fine if I ran it manually, but would not show up in Task Runner Explorer.
Reviving an old topic but here is what worked for me. YMMV.
In Visual Studio, go to: Tools -> Options -> Web Package Management
-> External Web Tools.
Move $(PATH) above $(VSInstalledExternalTools).
I have no idea if there are any side effects to doing this.
credit to: https://developercommunity.visualstudio.com/solutions/314606/view.html
I found the following error which led me to do a rebuild:
Error: Missing binding A:\Projects\Repos\chapelstudios_www\node_modules\node-sass\vendor\win32-x64-79\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 13.x
Found bindings for the following environments:
- Windows 64-bit with Node.js 10.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
As Jake mentioned I tracked the error down to this line as well:
const sass = require('node-sass');
Running rebuild didn't work. I found that after upgrading node from version 10.x to current version (12.18 Windows) and then rebuilding fixed the issue.
npm rebuild node-sass
I am experimenting with an asp.net core MVC web app using Polymer, and largely things seem to be going well. I used the now built in bower.json file to specify required packages (eg paper-fab), and they were dutifully installed. Nearly every time I could just use the package name and version from the appropriate Polymer catalogue page (example). But with a couple of the pages (paper-ripple and paper-card) bower can't find the specified version, so I tried the wildcard approach which resolved to a much earlier version. For paper-ripple it didn't seem to cause any problems, but paper-card just doesn't seem to work for me.
Here is my bower.json file:
{
"name": "asp.net",
"private": true,
"dependencies": {
"jquery": "2.2.0",
"jquery-validation": "1.14.0",
"jquery-validation-unobtrusive": "3.2.6",
"polymer": "1.4.0",
"PolymerElements/paper-material": "1.0.6",
"PolymerElements/iron-icons": "1.1.3",
"PolymerElements/iron-image": "1.2.5",
"PolymerElements/paper-button": "1.0.13",
"PolymerElements/paper-icon-button": "1.1.3",
"PolymerElements/app-layout": "0.10.4",
"PolymerElements/paper-header-panel": "1.1.6",
"PolymerElements/paper-toolbar": "1.1.7",
"PolymerElements/paper-drawer-panel": "1.0.10",
"PolymerElements/paper-fab": "1.2.1",
"PolymerElements/paper-item": "1.2.1",
"PolymerElements/paper-listbox": "1.1.2",
"PolymerElements/paper-ripple": "*",
"PolymerElements/paper-card": "*",
"normalize-css": "4.1.1"
},
"resolutions": {
"polymer": "^1.2.1",
"paper-ripple": "^1.0.0",
"font-roboto": "^1.0.1"
}
}
I know I could just download the latest versions from the catalogue, but I'd rather continue using bower if I can.
Of course it's always possible I am doing the cards wrong!
<link rel="import" href="~/lib/bower/paper-card/paper-card.html" />
<paper-material main elevation="0">
#for (int i = 0; i < 10; i++)
{
<paper-card heading="Card #i">
<div class="card-content">Some content #i</div>
</paper-card>
}
</paper-material>
The cards are just being output into the DOM like this (usually when using chrome dev tools I can see all the local DOM inside Polymer elements, but not in this case):
<paper-card heading="Card 0">
<div class="card-content">Some content 0</div>
</paper-card>
EDIT: Potential Workaround
So I have found that rather than directly editing the bower.json file in Visual Studio (which updates all your packages when saving), if I open up cmd in the same directory as the bower.json file and run bower commands from there I can install the versions shown in the Polymer catalog. For example bower install --save PolymerElements/paper-ripple which then updates the bower.json file accordingly. Perhaps this is the best way of doing it rather than relying editing it manually and relying on VS to update the packages?
If you want to install latest version on every bower install command you can add caret(^) to all your bower dependencies. Currently you have hard coded all the versions that needs to be used.
You can check out this answer for more details on bower versions
I am a new developer working with ASP.NET 5 (ASP.NET Core). In VS2015 I created a new class library project targeting .NET Platform 5.4 (dotnet5.4), and added the AutoMapper NuGet package, version 4.2.0.
I am getting the following errors, basically for all the System packages:
3>C:\Users\Andrew\OneDrive\Development\Visual Studio\APT\src\Fideles.Service\project.json : .NET Platform 5.4 error NU1001: The dependency fx/Microsoft.CSharp could not be resolved.
3>C:\Users\Andrew\OneDrive\Development\Visual Studio\APT\src\Fideles.Service\project.json : .NET Platform 5.4 error NU1001: The dependency fx/System.Collections could not be resolved.
3>C:\Users\Andrew\OneDrive\Development\Visual Studio\APT\src\Fideles.Service\project.json : .NET Platform 5.4 error NU1001: The dependency fx/System.Collections.Concurrent could not be resolved.
But I think according to the NuGet package description it should be supported:
https://www.nuget.org/packages/AutoMapper/
As you can see from the screenshot these packages seem to be referenced twice; once correctly and once incorrectly with an fx/ prefix:
This is my project.json:
{
"version": "1.0.0-*",
"description": "Fideles.Services Class Library",
"authors": [ "Andrew" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-*",
"System.Collections": "4.0.11-beta-*",
"System.Linq": "4.0.1-beta-*",
"System.Runtime": "4.0.21-beta-*",
"System.Threading": "4.0.11-beta-*"
}
}
},
"dependencies": {
"AutoMapper": "4.2.0",
"Fideles.Common": "1.0.0-*",
"Fideles.Data": "1.0.0-*"
}
}
Any ideas? Thank you!
The issue is that dotnet5.4 isn't supported by AutoMapper 4.2.0. Depending on what you're targeting it may be possible to change dotnet5.4 to something else (dnxcore50 for example).
I have the same issue on a number of my own libraries and I'm waiting for netstandard to take care of all this.
If you don't mind interrupting your Visual Studio workflow you can get your application to build by doing the following.
Make sure you have the new dotnet CLI installed
(https://dotnet.github.io/getting-started/)
Run dotnet restore from the command line in your project folder
This sorted out the the build errors. I then deleted my lock files and ran Clean and Rebuild on the solution for good measure.
We have to use DNX core 5 and OpenXml, for XLS export, in our app.
It seems like the OpenXml dependency is not supported, according to the error message I got:
Error NU1002 The dependency DocumentFormat.OpenXml 2.5.0 in project does not support framework DNXCore,Version=v5.0. project.json
Here is the part of the project.json associated with the problem:
"frameworks": {
"dnx451": {
"dependencies": { },
"frameworkAssemblies": {
"WindowsBase": "4.0.0.0"
}
},
"dnxcore50": {
"dependencies": {
}
}},
Adding manually the same frameworkAssemblies element to the "dnxcore50" node does not seem to fix the problem.
Removing the "dnxcore50" node makes the app to compile, but this compromises the benefits of dnx Core 5.0 advantages.
This similar question did not properly answer my question :
Open XML in dnx5.0 / aspnext
Does anyone have a solution ?
Unfortunately there is currently no nuget package for the Open Xml SDK.
However, some people are already working on creating such a package:
https://github.com/OfficeDev/Open-XML-SDK/issues/65
Update 24th May.
The community worked for .NET Standard support 😊.
It should work for .NET Core, if not it will be very soon.
Follow the evolution here:
https://dotnet.myget.org/gallery/open-xml-sdk
I'm trying to include the ui-mask utility in my projects bower.json file so other devs will be able to install it when running bower install.
I can install it manually with bower install angular-ui-utils#bower-mask,
but in my bower.json file I can't figure out the correct name/version. Should be mask-0.1.1
Angular UI-Utils
UI-Util Mask Module
What I want to work in bower.json:
{
"name": "project-name",
"dependencies": {
"jquery": "^2.1.x",
"angular": "~1.3.x",
"angular-route": "~1.3.x",
"angular-touch": "~1.3.x",
"angular-sanitize": "~1.3.x",
"at-table": "1.0.1",
"ngDialog": "0.2.13",
"angular-local-storage" : "0.0.7",
"angular-ui-utils#bower-mask" : "0.1.1" <- This should work
}
}
When using bower install angular-ui-utils#bower-mask you instruct bower to look for angular-ui-utils with a "bower-mask" version.
A version in this case is actually a git tag, branch or commit hash (when bower is using a git resolver).
Since the the angular-ui/ui-utils repository has a bower-mask branch it will be resolved.
If you would like to resolve bower-mask 0.1.1 you will need to find the correct tag in the Github repository. In this case this should be mask-0.1.1, so what you need in bower.json is:
{
"name": "project-name",
"dependencies": {
"angular-ui-utils" : "mask-0.1.1"
}
}
In the bower output you should see:
bower resolve git://github.com/angular-ui/ui-utils.git#mask-0.1.1
bower download https://github.com/angular-ui/ui-utils/archive/mask-0.1.1.tar.gz