I'm using YUI Compressor as a MsBuild Task on my Azure project. It works well on locally but when I try to publish it I cannot insert minified packages to my azure application package. Although I have tried a lot of things about package modifying on my .csproj file I couldn't work it out. How can I do this?
Edit:
My project is not a MVC or Webforms application. Just HTML and Javascript inside of an ASP.NET project. My problem is not minification. It is just placing minified external files in Azure Package when publishing it but if there is any other method that solves this azure problem, I can change YUI Compressor with ajaxmin or google closure... doesn't matter.
I don't think modifying the service package is supported (you are also modifying the manifest). That's why I would look at it from an other perspective. I'm assuming you have such a setup:
Solution
Empty ASP.NET Project
Index.html
App.js
Now, after you compile (and the MSBuild task runs) you'll have something like this:
Solution
Empty ASP.NET Project
Index.html
App.js
App.min.js (not included in the project, but available on the file system)
Now, buy simply including the App.min.js file in the project, it will be included in the service package when packaging or publishing your application. And besides that, the MSBuild tasks runs each time you compile, meaning the file will be updated before each time the application is packaged.
As you haven't specified about about whether it is WebForms or MVC, I would like to point out the out of the box support for the bundling and minification in ASP.net MVC4. Scott Gu has explained it the MVC4 preview demo.
You can also tweek it to work a way for that in ASP.net MVC3 too. Once this is achieved, you can achieve that in Azure as well.
Additional Articles :
ASP.NET MVC4 bundling in ASP.NET MVC3
New in ASP.NET MVC4: Bundling and Minification
Related
I lost one week of development because of not committing my code. I work on a personal project and I lost my code I only have the published version of my asp.net core 3.1 project. and my code is not obfuscated.
I use DotPeek to open my main dll and I get controllers but there are no views in there ? I wonder to know, is there any way for me to create a solution like I had without creating views by my hand?
Is it possible to completely regenerate Visual Studio solution folder for this project from Published files?
I have created a asp.net core 2.2 web app and I want to integrate TinyMCE in it. I found out that you can download it as a nuget package but when I installed it, the package did not come with the TinyMCE js template folder(It just said that the package was installed and that's it). How can I install TinyMCE properly?
NuGet does not support copying content files to your project directory any more. This was changed when PackageReference was introduced which is the new default and only supported way to include package references in .NET Core projects.
So while TinyMCE still updates the NuGet package, you will only be able to consume it properly in classic non-Core ASP.NET MVC projects on the .NET Framework.
If you want to use TinyMCE in ASP.NET Core, you should look at other mechanisms to include JavaScript dependencies in your application.
When you take a look at TinyMCE’s “Get TinyMCE” page, you will see a few options. If you already have some npm-based deployment set up, then you should probably get it from npm. Otherwise, you can also just download a static release and copy it into your wwwroot directory. This would actuallly have the same effect as using the NuGet package (if that worked).
I want to start playing with Aurelia and MVC 6 Web API with Visual Studio 2015 RC, and I'm using OdeToCode's blog post as a starting point.
I understand the idea behind the new wwwroot folder, but I'm basically confused as to what should or shouldn't put in there.
My initial thought would to install all jspm packages as well as the actual JavaScript source files outside the wwwroot folder, and then copy with gulp everything that's necessary for running while developing or bundle and copy when deploying.
It would look something like this:
But then again, should I place index.html also in the src folder? and config.js? Or am I actually making my life difficult for myself and should just develop from within the wwwroot folder?
It's the jspm packages that confuse me; it feels wrong to have such a large amount of JavaScript files in the wwwroot when I plan on bundling and minifying anyway.
In short: What would be the preferred folder structure for an Aurelia ASP.NET 5 app in Visual Studio 2015?
I spent quite some time on this and finally settled on:
ApplicationName
src
Api
In here I have an ASP.NET 5 project that provides the api to be consumed by the Aurelia app. You will likely need to turn on CORS to avoid errors.
Client.Web
In here I started with the Aurelia skeleton navigation app. We changed the dist folder to wwwroot. The jspm_packages folder sits outside the wwwroot and the gulp tasks that come with the skeleton navigation app take care of all the copying to wwwroot as needed.
This approch gave me the following benefits:
Clean separation of the api and the client code.
Option to deploy the api and client separately.
Ability to leverage all of the gulp tasks that come with the skeleton navigation app
Clear place to switch over to the Javascript file naming conventions (camelCase)
The drawbacks of this approach:
Starting the full app is more difficult. Currently, I have to click "Play" in Visual Studio to start the api, then I have to start gulp watch. This is not too big of a deal because you can mostly leave gulp watch running the entire time you develop.
I have a used the intranet template for a simple MVC 4 project.
I have tried to bundle separately my css and js.
All works ok until I change my web.config debug=false to make use of the minification.
When I run the project without debugging the application hangs and looking in firebug and fiddler it does not appear to make the requests for the bundles.
Have I missed sometin obvious?
make sure you are not trying to minify min versions of js and that you have the latest webgrease (1.3) from nuget.
I am pretty new to msbuild and aspnet_compiler.
I am using aspnet_compiler to compile web application project. Now I just saw the MSBuild.exe and noticed that its builds my website into the /mywebsite/precompiledWeb folder. Now why do I need to use MSBuild.exe? Can't I directly use the aspnet_compiler to see if my website can be built properly?
(Not sure if I explained it very well).
msbuild.exe is usually used to build projects and its dependencies. When you have a web application project with a project file, vs can use this to build not only your web project but all the dependencies involved. This would only build your source code files, not the markup files (.aspx,.ascx,.etc).
aspnet_compiler is meant to build a web site project that doesn't have a project file. This said, you can also use it to make sure your markup files are also built for your web application project.
You are correct you can manually invoke the aspnet_compiler.exe tool. But better would be to use Web Deployment Projects to help you do this.