dotnet / dotnet/sourcelink

EmbedUntrackedSources causes WPF project build to fail when obj folder is redirected

Open
#492 2 comments 0 reactions 0 assignees View on GitHub
external
Dominant language
C#
Stars
1.4k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

1. Create new WPF application in Visual Studio 2019 (.NET Core is what I chose)
1. Create a git repo around the solution.
1. In the solution directory, drop a Directory.Build.props file with this content to redirect the `obj` directory to a solution level (for a read only source tree):

```xml


$(MSBuildThisDirectory)\obj\$(MSBuildProjectName)\

```

The build succeeds. Now add these elements to the `Directory.Build.props` file:

```xml

true




```

Then build again.
The build will fail:

```
1>------ Rebuild All started: Project: WpfApp3, Configuration: Debug Any CPU ------
1>D:\obj\WpfApp3\Debug\netcoreapp3.0\MainWindow.g.cs(58,21,58,38): error CS1504: Source file 'MainWindow.xaml' could not be opened -- Could not find file.
1>D:\obj\WpfApp3\Debug\netcoreapp3.0\App.g.cs(51,21,51,31): error CS1504: Source file 'App.xaml' could not be opened -- Could not find file.
1>Done building project "WpfApp3.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.