New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging a web application fails silently #6904

Closed
CoskunSunali opened this Issue Jun 16, 2017 · 5 comments

Comments

Projects
None yet
5 participants
@CoskunSunali

CoskunSunali commented Jun 16, 2017

The scenario I am falling into requires me to develop plugins for a .NET Core web app. The plugins are standard NuGet packages. Some of the plugins require plenty of web related stuff and thus the plugin project's SDK is of type Microsoft.NET.Sdk.Web. It is also required to use the Web SDK in order to take advantage of Razor related stuff in Visual Studio (highlighting, intellisense, etc). - There was a bug somewhere tracking that issue but I had no luck finding it.

It seems that NuGet packages are not being generated for projects using the Web SDK.

Is this the result expected? If not, are you able to provide a workaround?

Steps to reproduce

  1. Create a web app using .NET Core 2.0 Preview 1 (no further modifications needed to reproduce)
  2. Right click the project and click "Package" or proceed to the folder containing the csproj file and execute command dotnet pack.

Expected behavior

NuGet package generated at .\bin\Debug

Actual behavior

No NuGet packages are generated. The dotnet pack command produces the following output.

C:\Users\Coskun\Documents\Visual Studio 2017\Projects\WebApplication1\WebApplication1>dotnet pack
Microsoft (R) Build Engine version 15.3.117.23532
Copyright (C) Microsoft Corporation. All rights reserved.


C:\Users\Coskun\Documents\Visual Studio 2017\Projects\WebApplication1\WebApplication1>

Environment data

dotnet --info output:

C:\WINDOWS\system32>dotnet --info
.NET Command Line Tools (2.0.0-preview1-005977)

Product Information:
 Version:            2.0.0-preview1-005977
 Commit SHA-1 hash:  414cab8a0b

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0-preview1-005977\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview1-002111-00
  Build    : 1ff021936263d492539399688f46fd3827169983

@CoskunSunali CoskunSunali changed the title from Packing a web application to Packaging a web application fails silently Jun 16, 2017

@livarcocc

This comment has been minimized.

Show comment
Hide comment
@livarcocc

livarcocc Jun 16, 2017

Member

This issue was moved to NuGet/Home#5436

Member

livarcocc commented Jun 16, 2017

This issue was moved to NuGet/Home#5436

@livarcocc livarcocc closed this Jun 16, 2017

@CoskunSunali

This comment has been minimized.

Show comment
Hide comment
@CoskunSunali

CoskunSunali Jun 16, 2017

@livarcocc Sorry for the wrong repository.

CoskunSunali commented Jun 16, 2017

@livarcocc Sorry for the wrong repository.

@smartcaveman

This comment has been minimized.

Show comment
Hide comment
@smartcaveman

smartcaveman Jul 8, 2017

So, I figured this one out. Details are below, @CoskunSunali

  • NuGet is exhibiting correct behavior. @livarcocc

  • The MSBuild configuration that ships with .NET Core 2.0 Preview disables NuGet packaging for any projects using the Microsoft.NET.Sdk.Web project.

  • It's reasonable to assume that this is actually not a bug but is an intentional safeguard against packaging web applications with prerelease dependencies.

  • The solution is to override the default configuration to disable packaging web applications. This can be accomplished easily in both the project or global scope.

Project Level Solution

  • This solution will fix NuGet generation for a single project.
  • Add the IsPackable property to the web application's .csproj with a value of true.
  • The csproj file from my working example of the project-level fix looks like this:
    <Project Sdk="Microsoft.NET.Sdk.Web" ToolsVersion="15.0">
      <PropertyGroup>
        <TargetFramework>netcoreapp2.0</TargetFramework>
        <IsPackable>true</IsPackable>
        ...

SDK-Level Solution

  • This solution will fix NuGet generation for all projects using the .NET 2.0 / VS 2017 preview.
  • Change the IsPackable property in the Microsoft.NET.Sdk.Web.ProjectSystem.props file of the .NET Core 2.0 Preview installation.
  • On my machine, this property was defined on Line 23 of C:\Program Files\dotnet\sdk\2.0.0-preview2-006497\Sdks\Microsoft.NET.Sdk.Web.ProjectSystem\build\netstandard1.0\Microsoft.NET.Sdk.Web.ProjectSystem.props as:
    <IsPackable Condition="'$(IsPackable)' == ''">false</IsPackable>
  • After applying the solution-level fix, Line 23 looks like:
    <IsPackable Condition="'$(IsPackable)' == ''">true</IsPackable>

smartcaveman commented Jul 8, 2017

So, I figured this one out. Details are below, @CoskunSunali

  • NuGet is exhibiting correct behavior. @livarcocc

  • The MSBuild configuration that ships with .NET Core 2.0 Preview disables NuGet packaging for any projects using the Microsoft.NET.Sdk.Web project.

  • It's reasonable to assume that this is actually not a bug but is an intentional safeguard against packaging web applications with prerelease dependencies.

  • The solution is to override the default configuration to disable packaging web applications. This can be accomplished easily in both the project or global scope.

Project Level Solution

  • This solution will fix NuGet generation for a single project.
  • Add the IsPackable property to the web application's .csproj with a value of true.
  • The csproj file from my working example of the project-level fix looks like this:
    <Project Sdk="Microsoft.NET.Sdk.Web" ToolsVersion="15.0">
      <PropertyGroup>
        <TargetFramework>netcoreapp2.0</TargetFramework>
        <IsPackable>true</IsPackable>
        ...

SDK-Level Solution

  • This solution will fix NuGet generation for all projects using the .NET 2.0 / VS 2017 preview.
  • Change the IsPackable property in the Microsoft.NET.Sdk.Web.ProjectSystem.props file of the .NET Core 2.0 Preview installation.
  • On my machine, this property was defined on Line 23 of C:\Program Files\dotnet\sdk\2.0.0-preview2-006497\Sdks\Microsoft.NET.Sdk.Web.ProjectSystem\build\netstandard1.0\Microsoft.NET.Sdk.Web.ProjectSystem.props as:
    <IsPackable Condition="'$(IsPackable)' == ''">false</IsPackable>
  • After applying the solution-level fix, Line 23 looks like:
    <IsPackable Condition="'$(IsPackable)' == ''">true</IsPackable>
@dasMulli

This comment has been minimized.

Show comment
Hide comment
@dasMulli

dasMulli Jul 9, 2017

Contributor

To cross-reference: The change was introduced in aspnet/websdk#165 by @vijayrkn. (Sadly without any reasoning / explanation)

Contributor

dasMulli commented Jul 9, 2017

To cross-reference: The change was introduced in aspnet/websdk#165 by @vijayrkn. (Sadly without any reasoning / explanation)

@vijayrkn

This comment has been minimized.

Show comment
Hide comment
@vijayrkn

vijayrkn Jul 10, 2017

Collaborator

@dasMulli This change was done for this bug fix - aspnet/websdk#150

Collaborator

vijayrkn commented Jul 10, 2017

@dasMulli This change was done for this bug fix - aspnet/websdk#150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment