Skip to content

Conversation

@radical
Copy link
Member

@radical radical commented Jul 27, 2021

TL;dr publish fails on any blazorwasm project with VS17

A recent commit[1] moved initializing $(_WasmIntermediateOutputPath) from
a target, to project level PropertyGroup. It is set as:

<_WasmIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm'))</_WasmIntermediateOutputPath>

The NormalizeDirectory call converts this to a full path, presumably
using the current directory.

Because we are setting $(_WasmIntermediateOutputPath) at the project
level, it gets evaluated during the evaluation phase. And the current
directory doesn't seem to be set to the project directory at that point
in VS. So, $(_WasmIntermediateOutputPath) gets a wrong path like:

C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm.

And then when actually publishing, it fails to create this directory
with:

Unable to create directory "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm\". Access to the path 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm\' is denied.

Fix:
Set the property in _InitializeCommonProperties target, at which
point the current directory is correctly set.

Note:

  • This doesn't seem to be reproducible outside VS
  • It happens only on publish, because that's when the wasm targets
    come into play.

--
1.

commit d574b032793ae752387d32b97ff9840de17420a2
Author: Ankit Jain <[email protected]>
Date:   Mon Jul 19 01:02:01 2021 -0400

    [wasm] Add support for using custom native libraries (#55797)

@radical radical requested a review from marek-safar as a code owner July 27, 2021 20:48
@ghost ghost added the area-Build-mono label Jul 27, 2021
@radical radical added the arch-wasm WebAssembly architecture label Jul 27, 2021
@radical radical requested a review from lewing July 27, 2021 20:48
@ghost
Copy link

ghost commented Jul 27, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

TL;dr publish fails on any blazorwasm project with VS17

A recent commit[1] moved initializing $(_WasmIntermediateOutputPath) from
a target, to project level PropertyGroup. It is set as:

<_WasmIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm'))</_WasmIntermediateOutputPath>

The NormalizeDirectory call converts this to a full path, presumably
using the current directory.

Because we are setting $(_WasmIntermediateOutputPath) at the project
level, it gets evaluated during the evaluation phase. And the current
directory doesn't seem to be set to the project directory at that point
in VS. So, $(_WasmIntermediateOutputPath) gets a wrong path like:

C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm.

And then when actually publishing, it fails to create this directory
with:

Unable to create directory "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm\". Access to the path 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm\' is denied.

Fix:
Set the property in _InitializeCommonProperties target, at which
point the current directory is correctly set.

Note:

  • This doesn't seem to be reproducible outside VS
  • It happens only on publish, because that's when the wasm targets
    come into play.

--
1.

commit d574b032793ae752387d32b97ff9840de17420a2
Author: Ankit Jain <[email protected]>
Date:   Mon Jul 19 01:02:01 2021 -0400

    [wasm] Add support for using custom native libraries (#55797)
Author: radical
Assignees: -
Labels:

arch-wasm, area-Build-mono

Milestone: -

@radical
Copy link
Member Author

radical commented Jul 27, 2021

This applies for preview7 too.

cc @pranavkm @danroth27

@radical
Copy link
Member Author

radical commented Jul 27, 2021

/backport to release/6.0-preview7

@github-actions
Copy link
Contributor

Started backporting to release/6.0-preview7: https://github.com/dotnet/runtime/actions/runs/1072672302

TL;dr `publish` fails on any blazorwasm project with VS17

A recent commit[1] moved initializing `$(_WasmIntermediateOutputPath)` from
a target, to project level `PropertyGroup`. It is set as:

`<_WasmIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm'))</_WasmIntermediateOutputPath>`

The `NormalizeDirectory` call converts this to a full path, presumably
using the current directory.

Because we are setting `$(_WasmIntermediateOutputPath)` at the project
level, it gets evaluated during the evaluation phase. And the current
directory doesn't seem to be set to the project directory at that point
in VS. So, `$(_WasmIntermediateOutputPath)` gets a wrong path like:

`C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm`.

And then when actually publishing, it fails to create this directory
with:

`Unable to create directory "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm\". Access to the path 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\obj\Release\net6.0\wasm\' is denied.`

Fix:
Set the property in `_InitializeCommonProperties` *target*, at which
point the current directory is correctly set.

Note:
- This doesn't seem to be reproducible outside VS
- It happens only on `publish`, because that's when the wasm targets
  come into play.

--
1.
```
commit d574b03
Author: Ankit Jain <[email protected]>
Date:   Mon Jul 19 01:02:01 2021 -0400

    [wasm] Add support for using custom native libraries (dotnet#55797)
```
@radical radical force-pushed the fix-blazorwasm-publish-vs-p7 branch from 9837359 to 83c0088 Compare July 28, 2021 16:37
@radical
Copy link
Member Author

radical commented Jul 28, 2021

This was already approved, and merged in preview7. Merging this.

@radical radical merged commit 7b3e22b into dotnet:main Jul 28, 2021
@radical radical deleted the fix-blazorwasm-publish-vs-p7 branch July 28, 2021 21:34
@ghost ghost locked as resolved and limited conversation to collaborators Aug 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-Build-mono

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants