Customise RTLCSS config for VS Web Essentials 2013 - visual-studio

Visual Studio Web Essentials has the ability to auto-generate a Right-To-Left variant for CSS files.
This will automatically change CSS properties such as padding-left to padding-right.
However it also does other things such as changing file names from "right.png" to "left.png".
Web Essentials uses RTLCSS to do this which I know can be configured to turn some of these features off.
There is no obvious option in Visual Studio to be able to config RTLCSS through Web Essentials.
I know that Web Essentials is consuming RTLCSS via NodeJS using the following file:
C:\Users{username}\AppData\Local\Microsoft\VisualStudio\12.0\Extensions{webessentials}\Resources\nodejs\tools\server\services\srv-rtlcss.js
I could update the following line in this file to add custom options, however this would be specific to my machine and not the MVC solution I'm using:
var config = configLoader.load(null, path.dirname(sourceFileName), { options: { minify: false } });
Is there a way I can configure RTLCSS for Web Essentials specifically for my MVC Solution?
For example I know Web Essentials allows Solution specific settings via a WebEssentials-Settings.json file. Can I customise this file to use a version of the srv-rtlcss.js file which I could include in my MVC solution?

Configuration can be set using one of the following methods:
Put your config into your projects package.json file under the rtlcssConfig property.
Use a special file .rtlcssrc or .rtlcssrc.json
To edit the global RTLCSS settings, open web essentials menu then select "Edit global RTLCSS settings (.rtlcssrc)"
This will create the default configuration for you and place it in C:\Users\{username}, To make these settings local, create a copy of .rtlcssrc and place it in your project.

Related

hide additional files when creating setup projects

I'm using VS19 setup project and I would like to hide an additional file that is needed for runtime but I don't like users to see it.
the file is added to the project as an embedded resource
is there any way to hide the file?

VS2019 Custom template not shown

I have created a custom template for VS2019 that contains two projects. Below is my root.vstemplate file
<VSTemplate Version="3.0.0" Type="ProjectGroup" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>Asp.Net Core Template EF Core</Name>
<Description>Asp.Net Core 3.1 Boilerplate template</Description>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>
</ProjectSubType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>Asp.Net Core Template EF Core</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<Icon>logo.png</Icon>
</TemplateData>
<TemplateContent>
<ProjectCollection>
<ProjectTemplateLink ProjectName="AspNet Core Ef Core">
src\AspNetCore3EfCoreTemplate\MyTemplate.vstemplate
</ProjectTemplateLink>
<ProjectTemplateLink ProjectName="AspNet Core Ef Core Web">
src\AspNetCore3EfCoreTemplate.Web\MyTemplate.vstemplate
</ProjectTemplateLink>
</ProjectCollection>
</TemplateContent>
</VSTemplate>
I followed the instructions of this link but my template is not shown when I try to create a new item in VS2019. Anyone knows why is this happening?
I followed the instructions of this link but my template is not shown
when I try to create a new item in VS2019. Anyone knows why is this
happening?
For the custom project template, the new VS2019 UI for creating projects cannot find custom project templates through filters and these templates actually exist in it.
All Langages, All Platforms and All Project Types and the search box lose the ability to filter custom project templates and this is a known issue in VS2019. But it still happens in the latest version VS2019 16.4.2. If you want to solve this annoying problem, you can report an issue to DC Forum to report this abnormal behavior for support. This might be a long process or you can try my suggestions below:
Suggestion
1) Do not use any filters in VS2019 Project UI and then drag to the bottom of all templates to find the custom template, which is usually inserted after all the default templates.
This picture shows it at the bottom of all templates.
2) change to use VS2017 which has no error about this.
Update 1
l have created with your further info and test in my side without any errors, my environment:
win10 enterprise 1903; VS2019 Community 16.4.2
My Steps:
1) l have created two projects into a same solution:
a Net Core 3.1 ClassLibrary project and a ASP.NET Core 3.1 Web Application project.
2) then click Export Template.. in the Project menu and export these projects as project template separately.
3) open the folder and unzip them into the same folder called src.
This shows the two unzip project folders in the src folder
Then, this shows the final form of the folder,and src folder contains the two project folders as the picture shows above
4) root.vstemplate is the code you provide. The project Template is called Asp.Net Core Template EF Core as you said. After that, I compress these two files into a package called multiple projects template,and then put this zip file into this path C:\Users\xxx\Documents\Visual Studio 2019\Templates\ProjectTemplates.
5) then I close VS Instance and then restart VS and clear all the filters and then pull the project templates to the bottom, and then look up at the bottom for a template called Asp.Net Core Template EF Core.
> l have found this template in my side and if you does not see this, please repair VS and then disable any third-party extensions in the Extension-->Manage Extension menu to prevent interference with VS. Besides, since your VS is 16.4.1, you could try to update it to 16.4.2.
Update 2
With your sample, l think l found the issue. The issue is that root.template cannot find the two contained projects:
You put root.template in the Src folder and the root.vstemplate file write these:
src\ClassLibrary1\MyTemplate.vstemplate
src\WebApplication3\MyTemplate.vstemplate
It uses relative paths to find these files and the current path where your root.vstemplate is located does not have src so it cannot find.
The solution is that you should put root.vstemplatein the same directory as the SRC folder and then compress these two. After that, put this Multiple.zip into C:\Users\xxx\Documents\Visual Studio 2019\Templates\ProjectTemplates.
Hope it could help you.
Visual Studio 2019 uses tags to filter projects. By default when you export a project template, the .vstemplate file doesn't contain the required tags. You need to edit the .vstemplate file and add the following tags in the TemplateData section (I.e. between <TemplateData> and </TemplateData>) and replace the values with the appropriate values for your template:
<LanguageTag>Language</LanguageTag>
<PlatformTag>Platform</PlatformTag>
<ProjectTypeTag>Type</ProjectTypeTag>
For example, here is the TemplateData for one of my custom templates:
<TemplateData>
<Name>MyCaliburnMicroTemplate</Name>
<Description>Caliburn Micro template I set up with basic localisation, logging, settings and themes implemented.</Description>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>Windows</ProjectSubType>
<LanguageTag>CSharp</LanguageTag>
<PlatformTag>Windows</PlatformTag>
<ProjectTypeTag>Desktop</ProjectTypeTag>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>MyCaliburnMicroTemplate</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<Icon>__TemplateIcon.ico</Icon>
</TemplateData>
I also set the <ProjectSubType> to Windows, but I haven't tested to see if this makes any difference.
Here's a picture of my 'Create a new project' window with the filters set to C#, Windows and Desktop:
Notice the tags now appear below the description of my project template. I'm currently using Visual Studio Community 2019 version 16.4.3, but haven't tested this with any other version.
Maybe this will help.
https://blog.jayway.com/2015/03/13/visual-studio-how-to-create-a-solution-template-with-multiple-projects/
The original documentation usually miss a step or 2 that looks obvious after you made a lots of templates.
This is what I did to make it work:
After the zip file of the template was created, I extracted it.
Then I copied the folder to the "ProjectTamplates" folder.
I was able to create a new project based on my template this way.
I was struggling with same issue, that my project does not apper in search window of projects in VS.
In folder "ProjectTemplates" I had zip that was containing dots in name. After removing them my project appeared in projects window in VS.
I hope this will help someone.

Changes in Angular component are not transpiled to js

I am developing my first ASP.NET Core application with Angular 2.
The application must have individual user access. Since there is no template in Visual Studio 2017 for Angular applications I generated an Angular project in Powershell with Yoman, opened it in another Visual Studio and copied all the Angular files and folders into my normal Visual Studio project which has the individual user access template generated.
I was able to make Angular work in my project. The three default pages generated by Yoman appear and work. The second one is a page with an increment button and variable. The problem is that if I change the increment in the "counter.component.ts" from this.currentCount++; to this.currentCount+=3; for example, the change is not reflected in the main-client.js file in the dist folder.
I have added the Target lines in the .csproj file and I do not know how to proceed.
What other options are there?
This is what I have https://1drv.ms/u/s!AvPiv6aM2fzRepKV9J_F0-387Zc
I have added "compileOnSave": true and it still doesn't work
Thank you very much for your help!
This is really dumb, but for anyone else that might come to this step, what I was missing was to build the Angular packages in "Startup.cs" (of course)
In Configure method, in the
if (env.IsDevelopment())
these lines:
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
HotModuleReplacement = true
});
and in
app.UseMvc(routes =>
these lines
routes.MapSpaFallbackRoute(
name: "spa-fallback",
defaults: new { controller = "Home", action = "Index" });

Visual Studio web deploy - simple way to include build info?

I have an ASP.NET site that I am deploying to Azure Websites. I have a production and staging environment there and it is easy to get lost which is which. During the web deploy ("Publish") from Visual Studio, is there some simple way to deploy some kind of build info that I could display either via the site itself or through the Azure Portal?
You can add a version number to your assembly by adding this line to AssemblyInfo.cs file
[assembly: AssemblyVersion("1.0.*")]
more details here and here
you can then expose it in your site however you want, maybe a hidden tag, some sort of debug info page, or write it to a file on Application_Start that you can look at later
for example in global.asax you can have
protected void Application_Start()
{
using (var writer = new StreamWriter("version.txt")
{
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
writer.WriteLine(version);
}
}
Generating a text file with current date as a post-build step was the easiest solution I found.

TypeScript - Visual Studio - d3

I created a new TypeScirpt project, added the json file to the solution, changed the 'Copy to Output directory' property to Copy always.
When I F5 the project, the browser complains that it cannot find the resource somedata.json
If I run the python SimpleHTTPServer, load up the same html file, it works.
<script type="text/javascript">
d3.json("somedata.json", draw);
</script>
Thank you.
Have you tried using the full path from the root of the site to obtain the somedata.json file?
d3.json("/scripts/somedata.json", draw);
Replace /scripts/ with the correct path in your instance, but start the address with a leading / to make it relative to the root.
This may be related to MIME types that the server used by Visual Studio is allowed to serve. You can define such MIME types at web.config btw if this is an ASP.net project.
Also see this official example in case it helps:
http://www.typescriptlang.org/Samples#D3
Have you tried to run the project using ASP.NET Development Server?

Resources