When I create a new project using a custom Visual Studio template the launchSettings.json file isn't picked up automatically by Visual Studio and the same goes for all the rules which it is trying to impose, they aren't imposed.
To attach the launchSettings file one has to right click on the docker-compose.yml file and click on Manage Docker Compose Launch Settings then wait for the launchSettings file to load and click save.
This is how the docker-compose.yml file looks :
services:
services:
splunk:
image: splunk/splunk:latest
pgadmin:
image: dpage/pgadmin4
This is how the launchSettings.json file looks
{
"profiles": {
"First Profile": {
"commandName": "DockerCompose",
"commandVersion": "1.0",
"serviceActions": {
"pgadmin": "StartWithoutDebugging",
"splunk": "DoNotStart"
}
},
"Second Profile": {
"commandName": "DockerCompose",
"commandVersion": "1.0",
"serviceActions": {
"pgadmin": "StartWithoutDebugging",
"splunk": "StartWithoutDebugging",
}
}
}
}
Please advise how can the launchSettings.json file automatically picked up by the Visual Studio on the first launch without having to click on Manage Docker Compose Launch Settings.
Related
I am trying to remove the IIS Express profile from my .NET Core launch settings but every time i repoen the solution, Visual Studio adds it back in again. For example, in a new project my launch settings looks like this
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55735/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"MyProject": {
"commandName": "Project",
"launchUrl": "http://localhost:5010",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
I remove the IIS sections
{
"profiles": {
"MyProject": {
"commandName": "Project",
"launchUrl": "http://localhost:5010",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
The solution runs fine. But as soon as I close and reopen the solution the IIS sections reappear.
Any ideas?
UPDATE:
The issue should be fixed with the latest release (update) of Visual Studio 2017 (version 15.3.0).
Initial answer:
This is not a solution, but an ugly workaround. I figured that if I would just deny permissions to change the launchsettings.json file this will prevent Visual Studio from overwriting it every time. Since this file doesn't change much, it is more or less a satisfying solution for me.
So:
Update your launchsettings.json for the last time.
Close Visual Studio.
Open security settings (right-click on launchsettings.json in Explorer -> Properties -> Security)
Click Advanced -> Change Permissions
Select "Authenticated Users" (or other user group under which Visual Studio is running on your machine) from the "Permissions entries" list and click Edit ->
Check Deny for "Create files / write data" permission.
Click OK in all open dialogs and warnings to save changes.
Reopen Visual Studio and see it fail to do it's update.
Hope it helps.
In my case the issue was related to a missing bracket at the end of the file, so Visual Studio was being unable to process it, please check the JSON format is correct.
just check your launch settings file is a valid for JSON format, you should forget a comma or mustache
I am attempting to add Facebook authentication into an Angular2-Meteor app that started off as the Socially app from the tutorial and is slowly being modified into something less generic. There doesn't seem to be much posted on this particular use case however.
Note: I've asked in the Meteor forums and Gitter without success already.
Here are the steps I've taken:
Added Service Configuration package using
meteor add service-configuration
Created a file at server/services.ts containing (with my actual keys):
ServiceConfiguration.configurations.upsert({
"service": "facebook"
}, {
$set: {
"settings": {
"appId": “appid”,
“secret": "secret",
"loginStyle": "popup"
}
}
});
But on compile, I get an error saying
cannot find name 'ServiceConfiguration'
Which makes me think the package didn't install properly, but uninstalling/reinstalling it has not resolved the issue and it is showing in my .meteor directory.
Client side I'm calling this method with a click event on a button in a component that does have Meteor imported:
facebook() {
Meteor.loginWithFacebook((err) => {
if (err) {
//Handle error
} else {
//Handle sign in (I reroute)
this.router.navigate(['/home']);
}
})
Which throws the console error
meteor_1.Meteor.loginWithFacebook is not a function
But I suspect this is secondary to the fact that ServicesConfiguration isn't registering.
Git repo of the project is here: https://github.com/nanomoffet/ng2-starter with the referenced files being server/services.ts and client/app.ts
Currently it is not possible to use the ServiceConfiguration in TypeScript. What I did in my application was that I created a Javascript file in which I did make the ServiceConfiguration calls.
meteor add service-configuration
Create the file ./server/service-config.js
Meteor.startup(() => {
ServiceConfiguration.configurations.remove({
service: "facebook"
});
ServiceConfiguration.configurations.insert({
service: "facebook",
appId: '<APP_ID_YOU_GET_FROM FROM_FACEBOOK>',
loginStyle: "popup",
secret: '<SECRET_YOU_GET_FROM_FACEBOOK>'
});
});
I only tested it with Google and works fine for me.
I have a Symfony2 project, where I have a Bundle that is generic (GenericBundle) accross multiple projects, and a site-specific Bundle (SpecificBundle) that is a child-bundle of GenericBundle.
When I am developing I want the GenericBundle to be loaded locally, from a specific directory, but when deployed I want it to behave as a normal VendorBundle.
I have setup my main composer.json in my Symfony2 project with this setting which makes it load the GenericBundle from my directory when developing:
"autoload-dev": {
"psr-0": { "": "../genericBundleDirectory/" }
},
This works fine, but how do I get the GenericBundle to load like a VendorBundle only in production-environment?
Normally you would have an src/ directory to accomodate your AppBundle and/or other bundles related to your application.
"autoload-dev": {
"psr-0": { "": "src/" }
},
I'm trying to get grunt working, with grunt-contrib-watch and grunt-contrib-compass.
So far, my Gruntfile looks like this:
module.exports = function (grunt){
grunt.initConfig({
compass : {
dist : {
options : {
debugInfo : 'true'
}
}
},
watch : {
files : ['*.html', 'js/*', 'sass/*'],
task : ['compass'],
options : {
livereload: true,
port : 35729
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch') ;
grunt.loadNpmTasks('grunt-contrib-compass') ;
grunt.registerTask('default', ['watch'])
} ;
I'm using chromes live-reload extension.
If I then run 'grunt -v', I can see that grunt watches my html and my sass files as expected. My browser tab reloads automatically, as expected.
In a browser tab I go to this address:
http://localhost:35729
However, in my browser I only see this upon loading and reloading:
{
tinylr: "Welcome",
version: "0.0.4"
}
I don't see my index.html. Just the object.
What do I need to do in order to see my site?
http://localhost:35729 is the address of the live reload server, not your website. Your website still needs to be served from it's own address/port, such as http://localhost:8000. Either through the grunt-contrib-connect task, some other node.js server or some server that serves files apache/nginx.
http://localhost:35729 is only used to load the live reload script into your page: <script src="http://localhost:35729/livereload.js"></script> and then upon changes will use a web socket to trigger and update your page on your website.
If you run with npm start, it will running on reload server.
So if you wanted to serve your website.
Try to use Multiplex
I develop an ASP.NET MVC solution with Durandal and Breeze. I need to translate frontend to french and dutch. How to proceed with Durandal/knockout?
In a classic ASP.NET MVC solution we have the opportunity to have the views rendered server side (thanks to razor).
Thanks for your help.
To expand on Rob's answer of trying the i18n.js plugin for require.js, here's the steps I followed (I'm working off the Durandal starter template in Visual Studio).
Download the i18n.js plugin and put it in the App folder.
Create an App/nls folder, which is where you will put the require.js resource bundles, e.g. App/nls/welcomeBundle.js.
define({
"root": {
"displayName": "Welcome to the Durandal Starter Project!"
},
"fr-fr": true
});
You'll see I added a line to tell require.js that there's a French version available. This will be created in App/nls/fr-fr/welcomeBundle.js, which I kinda did below (changed the to le :D)
define({
"displayName": "Welcome to le Durandal Starter Project!"
});
require.js needs to be configured initially with the locale (can't be done dynamically). So in the main.js file, I declare the below getLocale() function, which I use to configure the locale for require.js:
function getLocale() {
var locale = 'en-us';
if (localStorage) {
var storedLocale = localStorage.getItem('locale');
locale = storedLocale || locale;
}
return locale;
}
requirejs.config({
paths: {
'text': 'durandal/amd/text'
},
locale: getLocale()
});
In the welcome.js module I then load the bundle and use it for the displayName property:
define(function(require) {
var bundle = require('i18n!nls/welcomeBundle');
return {
displayName: bundle.displayName,
...
}
});
I then set the locale to French and reload the page via JavaScript:
localStorage.setItem('locale', 'fr-fr');
location.reload();
Hope that helps :)
Edit: 2013-04-04: I updated the above to initialize the locale in the main.js file and not in the shell.js module, as for some reason the locale wasn't being used correctly when loading the bundle in the shell module. Figure that it should be configured as soon as possible anyway.