Skip to content
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

"Issue: PowerShell file outside tools folder" with migrated VS2017 project #5176

Closed
Daniel15 opened this issue May 8, 2017 · 2 comments
Closed

Comments

@Daniel15
Copy link

Daniel15 commented May 8, 2017

Details about Problem

When I run dotnet pack on a project that was converted from project.json to .csproj, I get this:

warning : Issue found with package 'React.MSBuild'. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Issue: PowerShell file outside tools folder. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Description: The script file 'content\tools\install.ps1' is outside the 'tools' folder and hence will not be executed during installation of this package. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Solution: Move it into the 'tools' folder. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Issue: PowerShell file outside tools folder. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Description: The script file 'contentFiles\any\net40\tools\install.ps1' is outside the 'tools' folder and hence will not be executed during installation of this package. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Solution: Move it into the 'tools' folder. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Issue: PowerShell file outside tools folder. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Description: The script file 'content\tools\uninstall.ps1' is outside the 'tools' folder and hence will not be executed during installation of this package. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Solution: Move it into the 'tools' folder. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Issue: PowerShell file outside tools folder. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Description: The script file 'contentFiles\any\net40\tools\uninstall.ps1' is outside the 'tools' folder and hence will not be executed during installation of this package. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]
warning : Solution: Move it into the 'tools' folder. [C:\src\React.NET\src\React.MSBuild\React.MSBuild.csproj]

The old project.json contained this, which worked:

  "packOptions": {
    "files": {
      "include": [
        "tools",
        "Content"
      ]
    },

New .csproj contains:

  <ItemGroup>
    <None Update="tools\**\*;Content\**\*">
      <Pack>true</Pack>
    </None>
  </ItemGroup>

Inspecting the resulting package with NuGet Package Explorer, it looks like the files are ending up in both content\tools and contentFiles\any\net40\tools:

On the other hand, the working package that uses project.json has them under tools:

(this is the package: https://www.nuget.org/packages/React.MSBuild/)

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):
dotnet.exe

dotnet.exe --version:

 dotnet --info
.NET Command Line Tools (1.0.0)

Product Information:
 Version:            1.0.0
 Commit SHA-1 hash:  e53429feb4

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16188
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.0

VS version: Visual Studio 2017

OS version: Windows 10.0.16188.1000

Worked before? If so, with which NuGet version: Yes, worked with older VS2015 project.json tooling

Detailed repro steps so we can see the same problem

Full csproj is included as part of this pull request: reactjs/React.NET#406 (React.MSBuild.csproj)

@Daniel15
Copy link
Author

Daniel15 commented May 8, 2017

The fix was to change it to:

    <Content Include="tools\**\*">
      <Pack>true</Pack>
      <PackagePath>tools\</PackagePath>
    </Content>
    <Content Include="Content\**\*">
      <Pack>true</Pack>
      <PackagePath>content\</PackagePath>
    </Content>

As documented at https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets#including-content-in-a-package.

It seems like the migration from project.json to csproj does not correctly migrate packOptions.files.include - It doesn't set the PackagePath so anything outside of the Content directory has the wrong path.

@Daniel15
Copy link
Author

Daniel15 commented May 8, 2017

Moved to CLI repo https://github.com/dotnet/cli/issues/6544

@Daniel15 Daniel15 closed this as completed May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant