dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.5k stars 10.04k forks source link

BlazorLib - PackageReference 0.2.0-preview1-10195 #16179

Closed dotnetnoobie closed 5 years ago

dotnetnoobie commented 6 years ago

Using Blazor Language Services 15.7.10222 (0.2.0 preview version)

When I make a Blazor Reusable Component I get old package references in the .csproj file

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <OutputType>library</OutputType>
    <IsPackable>true</IsPackable>
    <BlazorLinkOnBuild>false</BlazorLinkOnBuild>

    <!-- This custom package feed is required only when using nightly builds of Blazor -->
    <RestoreSources>https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;$(RestoreSources)</RestoreSources>
  </PropertyGroup>

  <ItemGroup>
    <!-- .js/.css files will be referenced via <script>/<link> tags; other content files will just be included in the app's 'dist' directory without any tags referencing them -->
    <EmbeddedResource Include="content\**\*.js" LogicalName="blazor:js:%(RecursiveDir)%(Filename)%(Extension)" />
    <EmbeddedResource Include="content\**\*.css" LogicalName="blazor:css:%(RecursiveDir)%(Filename)%(Extension)" />
    <EmbeddedResource Include="content\**" Exclude="**\*.js;**\*.css" LogicalName="blazor:file:%(RecursiveDir)%(Filename)%(Extension)" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.0-preview2-final" PrivateAssets="all" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.2.0-preview1-10195" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.2.0-preview1-10195" />
  </ItemGroup>

</Project>

The other thing I noticed is that the OutputType is set to Library but if I look at the properties dialog in VS 2017 preview 3.0 It tells me I have an output type of Windows Application

untitled

dotnetnoobie commented 6 years ago

In the BlazorLib template in the .csproj file

the showing as a Windows Application seems to be due to this line in the .csproj

<OutputType>library</OutputType>

if I change it to use a capital L

<OutputType>Library</OutputType>

Then in the Properties dialog it shows correctly as a Class Library

borakasmer commented 6 years ago

Hi! I install .NET Core SDK 2.1.300-preview2-008533 on my Mac (Os x- macOS High Sierra). And Blazor Template. But when I create new blazer project always comes to old version "0.1.0"!

danroth27 commented 6 years ago

Typically you end up with old templates if you have some issue with the configuration of your nuget package sources. Make sure you're getting Microsoft.AspNetCore.Blazor.Templates from nuget.org and not from myget or any other package source.

To ensure you're getting the templates from the right place try this:

dotnet new -u Microsoft.AspNetCore.Blazor.Templates
dotnet new -i Microsoft.AspNetCore.Blazor.Templates --nuget-source https://api.nuget.org/v3/index.json

I think this will resolve your issue, so closing, but please reopen if you still run into problems.