SignalR: Cannot get js libraries in Visual Studio 2017 project - asp.net-core

Trying to following this tutorial to get basic SignalR working:
https://learn.microsoft.com/en-us/aspnet/core/tutorials/signalr?tabs=visual-studio&view=aspnetcore-2.2
I am using Visual Studio 15.9.7
the tutorial includes the instructions below, but when I follow them, the modal window disappears without any kind of message and I do not have the signalr javascript libraries anywhere. The lib/signalr folder isn't extracted into my application. Nothing.
I looked around to try and figure out where to download them manually. Nothing.
I tried running all the Package Console commands to try and get signalR. like this one: npm install #aspnet/signalr
Nothing.
Is there an easy and proven way to just get these js libraries?
In Solution Explorer, right-click the project, and select Add > Client-Side Library.
In the Add Client-Side Library dialog, for Provider select unpkg.
For Library, enter #aspnet/signalr#1, and select the latest version that isn't preview.
Add Client-Side Library dialog - select library
Select Choose specific files, expand the dist/browser folder, and select signalr.js and signalr.min.js.
Set Target Location to wwwroot/lib/signalr/, and select Install.
Add Client-Side Library dialog - select files and destination
LibMan creates a wwwroot/lib/signalr folder and copies the selected files to it.

Firstly, you can try to update your Visual Studio and check if it can help fix the issue.
Besides, to add the SignalR client library to the project, we can also use LibMan Cli command.
Run the following command to install LibMan (if not installed it before)
dotnet tool install -g Microsoft.Web.LibraryManager.Cli
Run the following command to get the SignalR client library
libman install #aspnet/signalr -p unpkg -d wwwroot/lib/signalr --files dist/browser/signalr.js --files dist/browser/signalr.min.js

Related

GlassFish 4.1.2 updatetool/pkg tools fail - missing pkg-bootstrap

Summary: The pkg-bootstrap.jar and related files are missing from the latest GlassFish 4.1.2 and this prevents the updatetool from running. What is the proper way to install and run updatetool on Windows 10?
Detail: I was working with the Java EE 7 tutorial and downloaded the Java EE 7 SDK Update 3 (not Web Profile) which is based on GlassFish Open Source Edition 4.1.2. I ran into a problem running the updatetool on Windows 10. When run, it gives the option to install itself but the installation fails. It looks like the update tool uses the pkg tool, and that uses a pkg-bootstrap to install itself the first time. However, this is no longer included in GlassFish 4.1.2. When the updatetool is run, it produces the following errors:
C:\glassfish4\bin>updatetool
The software needed for this command (updatetool) is not installed.
If you choose to install Update Tool, your system will be automatically
configured to periodically check for software updates. If you would like
to configure the tool to not check for updates, you can override the
default behavior via the tool's Preferences facility.
When this tool interacts with package repositories, some system information
such as your system's IP address and operating system type and version
is sent to the repository server. For more information please see:
http://wikis.oracle.com/display/updatecenter/UsageMetricsUC2
Once installation is complete you may re-run this command.
Would you like to install Update Tool now (y/n): y
C:\glassfish4>"C:\Program Files\Java\jdk1.8.0_121\bin\java" -Dimage.path="C:\glassfish4\bin\\.." -jar "C:\glassfish4\bin\\..\pkg/lib/pkg-client.jar" refresh
Error: Unable to access jarfile C:\glassfish4\bin\\..\pkg/lib/pkg-client.jar
C:\glassfish4>"C:\Program Files\Java\jdk1.8.0_121\bin\java" -Dimage.path="C:\glassfish4\bin\\.." -jar "C:\glassfish4\bin\\..\pkg/lib/pkg-bootstrap.jar" "C:\Users\[userid]\AppData\Local\Temp\pkg-bootstrap21687.props"
Error: Unable to access jarfile C:\glassfish4\bin\\..\pkg/lib/pkg-bootstrap.jar
C:\glassfish4\bin\pkg does not exist in either the latest Java EE 7 SDK Update 3 or the latest GlassFish 4.1.2. Some research on the nightly builds shows that the directory trees glassfish4/.org.opensolaris,pkg and glassfish4/pkg were removed between builds glassfish-4.1.2-b03-02_25_2017 and glassfish-4.1.2-b03-03_07_2017. I can't find anything that explains why they were removed or an alternate way to install the updatetool. My work around was to copy the two trees from glassfish-4.1.2-b03-02_25_2017 into c:\glassfish4 (from the Java EE 7 SDK Update 3) and that seems to work. But, I figure that if this was removed, there was a good reason for it, and I shouldn't be hacking it.
If there was a separate installation step for the package tool, I missed it. What is the proper way to get the updatetool to run on GlassFish 4.1.2?
I have jdk1.8.0_121 and jre1.8.0_121.
Thanks for your help.
I had the same problem as DevDevDev.
I went to the link in his post:
http://download.oracle.com/glassfish/4.1.2/nightly/index.html
Downloaded the archive:
glassfish-4.1.2-b03-02_25_2017
http://download.oracle.com/glassfish/4.1.2/nightly/glassfish-4.1.2-b03-02_25_2017.zip
Extracted the missing folders into my glassfish directory:
/glassfish4/pkg
/glassfish4/.org.opensolaris,pkg
As DevDevDev I have questions about why it was removed but it works for me...for now.... Hope it helps someone else. Thank you DevDevDev I would not have solved this without your post!
I was working with Java SE. Then I needed to work with JAX-WS, so I went into the same website as you.
Basically, it says that you have to:
Download the package (a compressed file with a folder called glassfish4)
Unzip the downloaded file (does not specify where)
voilá
It did not work for me, so I kept searching and I found this: https://forums.netbeans.org/post-91328.html
You just need to download this update from netbeans plugin Manager:
"Java EE Base"
Good luck!
I got the same problem too. It seems that glassfish 4.1 did not integrate the Update Tool, so as doc of oracle suggests, we'd better install SDK 6(glassfish 3). Here is Java EE 6 SDK Update 3, note that the version provided here is with JDK 7. If you already installed JDK in your windows 10, you may ignore it.
When you finish downloading the .exe file, you should not install SDK by double-click the .exe file. Instead, you should run below command:
java_ee_sdk-6u3-jdk7-windows-x64.exe -j [JRE-Home]
note, command here is the name of your .exe file and it needs console arg of JRE Home, mine command is as below:
java_ee_sdk-6u3-jdk7-windows-x64.exe -j D:\JDK\jre
It seems that unzipping the file using Windows explorer's zip support doesn't work properly. If you instead do as described in the README and run:
jar xvf glassfish-4.1.zip
The archive is extracted properly and all the needed pkg files are there.
What files do you need? I had the save problem I was looking for the files of tutorial. Finally I found them here: ..../glassfish4/docs/javaee-tutorial/

Toolbar missing when running ASP.NET core from Visual Studio Code

Environment: Ubuntu 16.04, .NET Core 1.10 (1.0.0-preview2-1-003177), Visual Studio Code 1.8.1
I just generated a new ASP.NET Core app. When I run the app from a terminal window, the start up web page gets displayed as expected.
$ cd MyApp
$ dotnet run
However, the web page is slightly different when I load MyApp folder from VSC and press F5 to debug it. Specifically, the default top toolbar is missing. Toolbar items such as Home, About, Contact, etc. line up in a single column.
I have compared the generated html between the two. When run from the command line, the stylesheet links are:
href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css"
href="/css/site.min.css"
When run from VCS, the links are:
href="/lib/bootstrap/dist/css/bootstrap.css"
href="/css/site.css"
On examining local file structure, I see file css/site.css is present under folder wwwroot. However, I don't see any lib folder at all.
More information. Turns out _Layout.cshtml adds links based on environment names. When the names are Staging and Production, the generated bootstrap link is for ajax.aspnetcdn.com. For "Development," the link is "/lib/xxx."
Wondering how I force VCS to automatically populate bootstrap.css into lib directory.
Problem solved. When the website is generated, a file, bower.json, is created. This file has information about the bootstrap package. However, for some reason, this package is not automatically downloaded. You need to do the following:
From VSC, install the bower plugin by running "ext install bower."
Press F1 and type Bower. Next type, "Bower Update."
This is it. The plugin will download the bootstrap package and populate it in wwwroot/lib directory. Now, the website would work as expected from within VSC.
Hope the next version of VSC will have bower integrated.
It seems like when your app runs from VS Code, it is not serving the CSS files.
To troubleshoot further, looking at the launch.json, project.json, and Startup.cs files is necessary. My guess is that your launch.json is setup to run under a slightly different configuration than your dotnet run command is from the terminal. That is resulting in...
not serving static files at all, or
not including CSS files in the app's build output.
From your question update, the problem is that your launch.json is running under in the Development environment and your terminal is running under the Staging or Production environment. The former serves bootstrap locally; the latter serves it from a content delivery network.
When running in the "Development" environment, you need to install bootstrap locally and ensure it's in the /lib directory at runtime. That means installing the client-side packages. How to do that depends on the ASP.NET Core application template your using. For instance, if you generated your app with Yeoman, then you need to restore with Bower. Check for a gulpfile.js, a bower.json file, or a package.json that downloads, installs, and builds client-side dependencies, which likely include bootstrap.

npm/bower - Basic questions(Why it requires for just AngularJS then?)

I read about npm and bower, differences, usage, how it works, purpose as well. All explanation says that to work in NodeJs. But when I searched for AngularJS2, the tutorial says use npm. I have some basic questions based upon the understanding that npm basically for dependency management or packages to be installed.
How my Java/Eclipse workspace knows that npm installed the particular JS library/file, what path should be given in the html/web page for including those files/libraries?
If I move the web application to production, how will the server gets those dependent libraries? Even if server gets it, it might be installed in different folder. Basically how it can be managed with a web applications in different environments for just AngularJS app?
Can anyone please help me to have better understanding?
Finally found the answer. NPM is node package manager which helps basically to download the dependencies (almost like maven, gradle in java).
npm software needs to be installed in developer's machine.
Add the required dependencies in the package.json in the root folder of AngularJS application.
Open the DOS command line and navigate to project root folder(workspace/project in eclipse), then type npm install which will download all the dependencies mentioned in the package.json to a folder called npm_modules inside project folder.
The other and important advantage is npm can be used to install browser agent as well. So npm start command will open the browser and will load the application automatically in browser. Developer does not need to be aware about NodeJs. One more benefit of using this approach is the browser will get refreshed automatically when any update in the JS file gets saved.

DNX on VSO Host Build Controller

When trying to build an ASP.NET 5 DNX project on VSO, I get the following error:
Cannot find DNX runtime dnx-clr-win-x86.1.0.0-beta6 in the folder:
C:\Users\buildguest.dnx\runtimes (119,5): Error : The Dnx Runtime
package needs to be installed. See output window for more details.
Does this mean that we cannot use the host build controller with DNX projects yet?
Found a great guide on how to install dnx on vso host.
https://msdn.microsoft.com/Library/vs/alm/Build/azure/deploy-aspnet5
Added the first PreBuild.ps1 script as a Powershell build step and it worked right away.
Since I still use it, to compile my code, to me, it's not dead.
I integrated some travis-ci config in py project, have a look at my .travis.yml for an update, but I count on my host name, my pc, and my internet connection to serve it as I do since few years:
dnx-install.sh
Note that DNX should be able to build DNX,
from it's source code, even marked as obsolete, and that It would be possible, but painfull, to write some scripts and use mono-roslyn directly ... still not a dead branch to me.

How to require / add a dependency to Mono with PackageMaker or MonoMac?

I'm building an application which is made of four .app packages: a launcher, a client, a server manager and a runtime.
The launcher's .app is distributed in a .pkg file generated by MonoMac's packaging option. The other .app files are downloaded/auto-updated as ZIP by the launcher.
Bundling a copy of Mono within every single one of those .app files would be a waste of bandwidth / diskspace, but even more than that, I have a Mono server .exe file which is cross-platform and as such doesn't come in an .app bundle nor should pack any platform-specific DLLs. So bundling a private copy of Mono isn't an option.
Is there a way for me to create a .pkg file which has a dependency/requirement on a globally-installed Mono?
I see PackageMaker has a Requirements pane which can run scripts but I have no idea how to properly check whether Mono has been installed without relying on some hardcoded paths and stuff like that.
I'd like to have the installer check whether Mono is installed and if it isn't, install it (or, failing that, display a message with a link to the Mono website for instance).
I ended up switching to Packages which is a pretty neat tool.
I added a pre-install requirement of type "Shell script returns true". My shell script just checks for the "mono" executable using the "which" command:
#!/bin/bash
which mono
$(exit $?)
When the script returns false, I configured Packages to spit out an informative error message with a link to download Mono (for lack of a way to trigger download / installation of Mono).