Commit Graph

121 Commits

Author SHA1 Message Date
Steve Sanderson 0ca361a78a Make HttpClientHandler wiping more conservative. Fixes #1484 2018-10-01 12:44:05 +01:00
Ryan Nowak 5459107832 Fix #1298 (#1309)
* Fix #1298

This change lifts our Razor dependencies to 2.1.1. This is needed
because by default ASP.NET Core projects will depend on 2.1.1 - which
results in a conflict trying to use the Blazor compiler. The Blazor
compiler will load the 2.1.0 msbuild tasks, which then break loading the
2.1.1 tasks.

Since this is happening in the MSBuild process, we can't really write
any code to sort this out. We have to make sure the versions match.

In general the guidance for ASP.NET Core is that projects will **compile
against** 2.1.1 so this won't be a problem in the future unless a user
project specifically lifts ASP.NET Core to a higher version. If that's
the case they will also have to live `Microsoft.AspNetCore.Razor.Design`
to match.
2018-09-21 13:29:40 -07:00
Steve Sanderson b2f73492f5 Fix method wiping (#1448)
* Fix wiping assemblies that contain references to others in same directory

* Fix generated IL for reporting calls to wiped methods

* Add E2E test for method wiping
2018-09-20 10:20:37 +01:00
Steve Sanderson 03ff6ca022 Update jsinterop to version that supports Mono bfc35fc6e65 2018-09-03 17:47:05 +01:00
Steve Sanderson cf59ed94ad Consume jsinterop from submodule (#1351)
* Remove JSInterop files from this repo

* Add jsinterop submodule

* In Blazor.sln, reference jsinterop projects from submodule

* Update other references to jsinterop

* Fix TypeScript warning

* Include submodules in test/pack

* Update to newer jsinterop to fix JS pack issue

* Update to newer jsinterop to obtain strong naming

* Allow jsinterop submodule to inherit Directory.Build.props/targets

* Get latest jsinterop

* For AppVeyor builds, restore git submodules (happens automatically elsewhere)

* Update README.md with instructions to restore submodules
2018-08-29 11:10:35 +01:00
Nate McMaster 78045b2177 Automate authenticode code-signing using Roslyn sign tool
* Change project layout to prepare for upcoming Arcade changes
* Add signtool config file to configure OPC, NuGet, and Authenticode signing
* Fix a bug when BaseIntermediateOutputPath is set to an absolute path
2018-08-08 08:52:46 -07:00
Ryan Nowak 9778b2054a Add blazor.server.js (#1116)
Adds a server-side flavored blazor script.
2018-07-13 18:01:05 -07:00
Steve Sanderson ad7e98be04 Make index.html static again (#1123)
* Add build command for generating the new boot JSON file

* Remove build command for generating index.html

* Update build targets to generate blazor.boot.json

* Change SPA fallback routing to look for index.html in regular wwwroot. Will need to update setup for published apps later.

* Stop autorebuild when index.html changes, since we no longer 'build' that file

* Update Boot.WebAssembly.ts logic to use boot JSON info on startup

* Restore support for loading CSS/JS from Blazor library projects

* Use new startup script tag in all samples and templates

* Fix MonoSanity sample - it must now be an exe because we use that as the trigger to generate the boot json (not the presence of index.html any more)

* Fix SPA fallback routing for published apps

Because in a previous commit, I changed it to look for index.html inside "wwwroot" instead of "dist" (because we no longer build it). But "wwwroot" doesn't exist for published apps, because static file servers wouldn't understand it.

* CR: Fix path normalization
2018-07-13 09:49:34 +01:00
Ryan Nowak ee62bd8d45 Add startup for client/mono Blazor
This change adds a host builder, and the startup pattern for client-side
Blazor apps running in mono/wasm. This will help us align better with
server side Blazor.
2018-07-09 11:13:26 -07:00
Steve Sanderson cafb56569d Initial debugger support 2018-07-06 11:56:21 +01:00
Ryan Nowak 844e38e641 Update versions to 2.1
Updates ASP.NET package versions to 2.1

Tweaks TFMs
- libraries = netstandard2.0
- exes/apps/tools = netcoreapp2.1
- unit tests = netcoreapp2.0
- e2e tests = netcoreapp2.1 (dependency on apps)

The exception to this is the Browser.JS project which depends on our
tool for its build. however this project just builds the js code so its
TFM doesn't really matter.
2018-07-05 09:53:55 -07:00
Steve Sanderson a2bade57c3 Move Mono.WebAssembly.Interop project into "src" dir to match build conventions 2018-06-26 13:16:36 +01:00
Steve Sanderson b275055835 JavaScript interop v3 (#1033)
* JavaScript interop via new IJSRuntime abstraction

* CR feedback
2018-06-25 15:14:42 +01:00
Steve Sanderson 5dc5404570 Add notes on how to upgrade Mono, plus modify some files to make future
upgrades simpler
2018-05-24 15:55:01 +01:00
Steve Sanderson 353da42cce Clean up use of relative URLs. Fixes #844 and #845 (#878)
* Handle links to empty-string href, resolved against base href

Needed to change the URLs used in E2E tests to be able to cover this (i.e., removed the /RouterTest prefixes so the default relative URL became an empty string)

* Change links in StandaloneApp sample to be relative

* Standardize on base URIs having trailing slash everywhere

Hence also change terminology from "base URI prefix" to simply "base URI"

* Handle link highlighting when visiting base-href-but-without-trailing-slash

* Removing leading slashes from base-relative URLs in templates
2018-05-24 09:54:43 +01:00
Steve Sanderson e33cb4a354 Simple autorebuild mechanism for hosted apps (#787)
* Simple autorebuild mechanism for hosted apps

* CR feedback: DI changes; use Directory.EnumerateFiles

* CR feedback: Ensure FileSystemWatcher isn't GCed
2018-05-22 13:02:36 +01:00
Steve Sanderson 37788f3c9d In Blazor cshtml, auto-reference Microsoft.AspNetCore.Blazor and .Components (#751)
* In Blazor cshtml files, auto-import Microsoft.AspNetCore.Blazor and Microsoft.AspNetCore.Blazor.Components. Fixes #749

* Remove redundant @using directives from tests

* Update assertion in test

* Update all affected baselines
2018-05-05 17:55:08 +01:00
Steve Sanderson 20e43adac5 camelCase all the JSONs (#746)
* Add camelCase utility

* Use camelCase when JSON-serializing (but not for dictionary keys)

* Make JSON deserialization treat member names case-insensitively (but retain case on dictionary keys)

* Use camelCase in JSON in the samples and templates

* Reverse the order of the params for the camelcase test because it's weird otherwise

* CR feedback
2018-05-04 16:14:38 +01:00
Steve Sanderson b4e70e72a0 Disable autorebuild in hosted projects due to VS 15.7pre5+ issue 2018-05-02 18:34:16 +01:00
Steve Sanderson 644bd37e8c Add [Parameter] to route parameter in paging sample 2018-05-01 13:48:38 +01:00
Steve Sanderson 18b9a70dbe Encourage encapsulation of component parameter properties (#713)
* Before refactoring ParameterCollection assignment logic, add more test coverage

* Begin caching parameter assignment info

* Factor out some reflection code to a reusable location

* Use IPropertySetter to avoid all per-property-assignment reflection

* More error cases and tests for parameter assignment

* Enable binding to nonpublic properties

* Add analyzer to warn and provide fix for public component parameters

* Unit test for analyzer

* Component tag helper now includes private properties if they have [Parameter]

* CR feedback: Remove garbage from csproj

* CR feedback: Rename .Build.Analyzers to .Analyzers

* CR feedback: Move BlazorApi.cs to shared; use it from Analyzers test

* Fix incorrect test name

* Make as many parameters private as possible. Replace ILayoutComponent with BlazorLayoutComponent.

* In component tag helper discovery, consider private members too

* Reduce the work in component parameter discovery by not inspecting the BlazorComponent base class (or System.Object)
2018-05-01 10:08:01 +01:00
Ryan Nowak f661021324 Add [Parameter] for component parameters
This change introduces ParameterAttribute to specify a bindable
component parameter. As of the 0.3 release of Blazor we plan to make
[Parameter] required to make a property bindable by callers.

This also applies to parameters when their value is set by the
infrastructure, such as `Body` for layouts, and route paramters.

The rationale behind this change is that we think there is a need to
separate the definition of properties from their suitability for a
caller to set them through markup. We plan to introduce more features in
this area in the future such as marking parameters as required. This is
first step, and we think that this approach will scale nicely as we add
more functionaly.

The 0.3 release seems like the right time to change this behavior since
we're also introducing `ref` for captures in this release.
2018-04-30 13:35:08 -07:00
Steve Sanderson d02436d55c Bootstrap 4 and new styling (#619)
* Upgrade to bootstrap v4

Remove  redundant MIME type

* Add new styling to StandaloneApp

* Update THIRD-PARTY-NOTICES.txt

* Update version of Blazor used by templates when running from source

* Update styling on BlazorStandalone.CSharp template

* Tweak brace style

* Update styling in BlazorHosted.CSharp template

* Update E2E tests that rely on specific CSS

* Add Open Ionic fonts license to notices too
2018-04-19 21:06:28 +01:00
Ryan Nowak 8485e2ea10 Add support for Action event handlers
This change adds `Action` to the set of types that have an overload on
RenderTreeBuilder. Additionally, we special case `Action` in the runtime
because passing the event args via DynamicInvoke() would throw.

Finally, reverted some of the clutter introduced by the first pass of
the event handler feature.
2018-04-11 07:36:05 -07:00
Steve Sanderson 2478c164b5 Update Mono to 078d5147836 (#543)
* Update Mono to 078d5147836

* Update driver.c to match updated Mono version

* Rebuild Mono binaries

* Update dependency resolution baseline to match updated Mono BCL

* Add E2E test for new RuntimeInformation values
2018-04-11 14:00:03 +01:00
Luke Latham 945995199c Template/sample updates 2018-04-10 22:41:07 -07:00
Ryan Nowak 15ba614e6f Remove old workaround @onclick and @bind
This change removes support for the old syntax used for event handlers
and two-way binding.

See the relevant issues for details on the new features and
improvements:

bind https://github.com/aspnet/Blazor/issues/409
event handlers https://github.com/aspnet/Blazor/issues/503

Along with this change we've removed a few additional things Blazor
could do that aren't part of Razor's usual syntax.

----

The features that was used to make something like:
```
<button @onclick(...) />
```

is an expression that's embedded in a an element's attribute. This
feature might be useful in the future if we want to support 'splatting'
arbitrary attributes into a tag, but the runtime support for this isn't
accessible outside the Blazor core.

----

The features that implement:
```
<button onclick=@{ } />
```

have been removed in favor of a better design for lambdas, method group
conversions and other things for event handler attributes.

use `<button onclick=@(x => ...} />` instead.

We think is a better approach in general, because we want the app
developer to write and see the parameter list.

----

Both syntactic features that have been removed have dedicated error
messages in the compiler. If you're porting old code it should help you
figure out what to do.
2018-04-10 16:54:15 -07:00
Ryan Nowak f6479a75cb Remove workaround for old Razor tooling
This isn't needed anymore to support the Blazor design-time experience.

Now that it's gone, it will no longer cause conflicts with MVC's types
so we can remove the other workaround (privateassets).
2018-03-27 19:24:10 -07:00
Steve Sanderson fb3beab270 Link on build by default for all configurations, not only Release 2018-03-21 15:58:49 +00:00
Steve Sanderson 300c3f5c7d In StandaloneApp, add example of pagination backed by navigation 2018-03-20 14:01:32 +00:00
Steve Sanderson f703732e98 In templates, update _ViewImports/NavMenu to match updated APIs 2018-03-20 13:59:20 +00:00
Steve Sanderson 5bf0b891e9 In NavLink, support matching either complete URLs or just URL prefixes (both are necessary for typical nav menus) 2018-03-20 13:15:37 +00:00
Javier Calvarro Nelson 70c4501497 [Fixes #220] Support `@page` with custom route template on components
* Updates the router component to scan for components within assemblies.
* Parses the templates on `[Route]` in component instances and builds a
  route table that maps paths to components.
* Uses the route table to map paths to components.
2018-03-16 19:15:00 -07:00
Steve Sanderson f7830e7b77 Publishing support 2018-03-14 11:23:43 +00:00
Javier Calvarro Nelson 700c2203c6 [Fixes #66] Adds linking support to the build
* Switch the tasks used to generate the blazor output to be MSBuild based.
* Package the optimized mono runtime and the BCL inside a nuget package.
* Add opt-in support for linking the application on build.
* Make the whole build process incremental.
2018-03-14 11:23:43 +00:00
Ryan Nowak d175b4d38a Konvert to KoreBuild 2018-03-14 11:23:42 +00:00
Ryan Nowak 49c0596405 Use real component syntax for NavLink/NavMenu 2018-03-14 11:23:42 +00:00
Steve Sanderson a9cccccce5 Tweak HostedInAspNetClient.csproj for consistency 2018-03-14 11:23:41 +00:00
Steve Sanderson 85c515861c Update StandaloneApp 2018-03-14 11:23:41 +00:00
Ryan Nowak b47e3095ee Add Razor SDK and packages to templates 2018-03-14 11:23:41 +00:00
Ryan Nowak 211561a6a6 Implement 2-phase compilation
This is a working (all tests passing) implementation of the two-phase
compilation system we will need for component discovery.

This builds on top of work we've doing in Razor, including the Razor
SDK, MSBuild tasks, and CLI/server.

This currently *does* discovery components during the build process, but
it doesn't use that data for anything yet.

It works like this:
1. Generate class declarations (structure only, no method bodies)
2. Compile a 'temp' assembly using the .cs files and output of 1.
3. Do component discovery using the 'temp' assembly
4. Generate class definitions (including method bodies)
5. Compile the 'real' assembly using the .cs files and output of 4.
2018-03-14 11:23:40 +00:00
Ryan Nowak a053155ab4 Implement layout and implements with directives
- Remove haxxxx
- Add proper directives with tooling support
2018-03-14 11:23:40 +00:00
Steve Sanderson 649159e31d Use real BCL System.Net.Http.HttpClient. Implements #159 2018-02-28 17:37:42 +00:00
Steve Sanderson e3b995b933 Recompile Mono, updating MonoPlatform.ts to work with the newer version 2018-02-28 17:37:42 +00:00
Steve Sanderson 4bd3cd98d6 Simplify apps by moving some commonly used types into Microsoft.AspNetCore.Blazor namespace 2018-02-28 11:29:14 +00:00
Steve Sanderson f14c72bd9d Stop transitive dependency on Microsoft.AspNetCore.Blazor causing regular MVC view compilation error. Fixes #180 2018-02-27 22:23:48 +00:00
Steve Sanderson de2bfe5162 Fix regression in app startup when running in E2E tests 2018-02-27 16:57:07 +00:00
Steve Sanderson 3e5381c17e Rename .DevHost project to .Cli, and make it work as a DotNetCliTool 2018-02-27 12:17:35 +00:00
Steve Sanderson a5b5b3fa27 Set IsPackable=false on certain projects 2018-02-26 15:27:57 +00:00
Steve Sanderson 1c5acfbdcc Temporarily rename 'Json' to 'JsonUtil' to avoid name clash 2018-02-26 12:06:28 +00:00