-
Notifications
You must be signed in to change notification settings - Fork 121
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
SourceLink doesn't work well with WPF projects #91
Comments
The workaround is to add <DeterministicSourcePaths Condition="'$(EnableSourceLink)' == ''">false</DeterministicSourcePaths> to the .csproj file. |
I get this in |
Or is the issue that I am building an entire solution and source link doesn't like multiple I've fixed the error by adding the code above to the two test projects - https://github.com/JamesNK/Newtonsoft.Json/pull/1746/files#diff-9d91529ee3797584a27061bbad1d49ceR16 |
The issue in Newtonsoft.Json is related but different than the WPF issue. When In projects that do not reference SourceLink package this The recommendation is to include the SourceLink package reference to all projects in the repo (even to test projects). This can be easily accomplished via adding <Project>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="..." PrivateAssets="all"/>
</Project> [1] The compiler does not infer the source root(s) based on source file paths it is given as this might produce confusing results. Consider a repo with two projects:
If the compiler inferred the source roots for these projects they would be |
In my case I have a src project with .NET Framework and a test project, building and packaging in a Jenkins. So that I need to turn on DeterministicSourcePaths for the msbuild.exe. (Turn on ContinuousIntegrationBuild has no effects at all.) Then the work around suggested above won't work anymore, as the Property value supplied at command line to msbuild.exe overrides csproj settings. In order to "remove" the test project from sourcelink process, I need to add this to the test csproj file:
|
Does your project set
Why do you need to remove it? |
if you mean /Deterministic to the Roslyn, I didn't set it.
Because I don't want to install SourceLink nuget package into my testing project, and then the compile would error out. |
Since you do not import Microsoft.Net.Sdk and do not set Deterministic then ContinuousIntegrationBuild has no effect since only affects deterministic builds.
What error does it report? |
msbuild on the src csproj alone would work, if msbuild the solution file, which including the test project, would give above error. |
Right, so that's because you don't have SourceLink and you switch DeterministicSourcePaths to true. I guess I do not understand why you don't want SourceLink in your testing project. |
@tmat The reason to use SourceLink is because I'm nuget packaging my library code into nupkg, but I'm not packaging my tests, at least in my case, test project was run to verify the library project then the lib nupkg is produced on Jenkins. |
…ourceLink is disabled.
This should solve this issue popping on AppVeyor: > SourceRoot items must include at least one top-level (not nested) item when DeterministicSourcePaths is true See explanation in dotnet/sourcelink#91 (comment)
Source link is currently broken for WPF as per dotnet/sourcelink#91.
For lack of a better place than this long-closed issue:
|
The workaround above by @shuebner stopped working in VS 17.8.0 Preview 4.0:
I belive it can be fixed by changing the condition to |
@Dunge looks good to me. Does the issue (without workaround) reproduce when using .NET 8 SDK? |
@tmat you are right, I do not remember the error that forced me to add this workaround a few years ago, but it doesn't seem necessary anymore. |
Error
is reported when building with
/p:ContinuousIntegrationBuild=true
.Due to NuGet/Home#5894 - WPF projects do not import .props and .targets files from NuGet packages.
The text was updated successfully, but these errors were encountered: