-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
dotnet build /p:ContinuousIntegrationBuild=true doesn't work #16325
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
@jaredpar Do you know about ContinuousIntegrationBuild or who we should bring in to take a look? |
@jaredpar so the compiler is doing the correct thing. It's possible that N.P.E is doing the wrong thing. Is there a way I can locally check that a dll which I've built with the |
@PureKrome recent versions of ILSpy will display whether or not the binary was built deterministically. You can also look at the binary log to see if it's being passed to the compiler. |
Cheers @jaredpar - time to google what all that means / how to do all of that :) |
I also have same issue - I'm using ContinuousIntegrationBuild but NGPE is showing that package is not deterministic. I have checked IL Spy and indeed it says: "This assembly was compiled using the /deterministic option." so maybe it is a bug in NGPE |
I am currently fighting with this, specifically with GitHub Actions not respecting the Debugging into both ILSpy and NGPE, I can see they're looking at different things:
|
I've narrowed this down to "seemingly nondeterministic behavior" with My workaround for now will be to have the workflow |
@SteveDesmond-ca - mate. REALLY appreciate your work/effort on debugging this issue. I love things right .. so this has been killing me for ages :(
Interesting you're saying this. I've been sorta already doing this. I actually have a CI "matrix" where it does CI in -both- DEBUG and RELEASE modes.
this way, the 'CI RUN' will always have the one binary everything is worked against. So if this is the 'DEBUG CI run', then it does most steps against the debug version of the run. versus a single run which does different CONFIGURATION builds during it. Now back to what you said:
I thought was doing that above ... and it wasn't working :( I thought that the RELEASE config is used for the BUILD step. So if we do so with my example above, i thought:
so i'm all confused :( |
I've just hit this too on https://github.com/DamianEdwards/MinimalValidation. I haven't been able to workaround it by being explicit when calling |
I noticed that paths were getting 'normalized' when I build a project with Microsoft.SourceLink.GitLab package installed and as soon as I uninstalled SourceLink, ContinuousIntegrationBuild=true has no effect. |
Added "Microsoft.SourceLink.GitHub" dependency, and it works... |
I'm discovering the same, unfortunately I found this after hours of troubleshooting / coming to the conclusion. My pipeline consists of 1) build (/p:ContinuousIntegrationBuild=true), 2) test, 3) pack (--no-build); I added --no-build arguments to the test step which seems to have resolved my issue; the test step must have been affecting the results of step 1 / build. |
I've added
I would have expected to find |
nuget paths in pathmap make the result more reproducible by hiding the C:\Users\TFS path from debug info so that the result can be the same even if built with a different user account. |
Ok so after some more tinkering, adding an explicit
I then had to drop a <Project>
<ItemGroup>
<SourceRoot Include="$(MSBuildThisFileDirectory)"/>
</ItemGroup>
</Project> and that + EDIT:
so that looks good but stacktraces still start with EDIT 2: |
Looks like the issue is still with us. |
See also dotnet/roslyn#55860 |
I could observe that a lot of reasons are showing this behaviour. In my case a referencing NuGet has a |
@TomJMaher thanks for the input. I agree heaps with your thoughts, also. But was is weird (frustrating) is that .. when I manually say By that, I mean NGPE still reports the package with an ❌ for deterministic. But based on what we're all saying (using the |
Have you seen (and tried) the comment above about |
Nope .. because I feel like doing changes like that are undocumented hacks, right now. Either the concept/documentation is wrong or there's a potential bug. |
Yes, there is a bug. That's what dotnet/roslyn#55860 is about. |
Same here, but always instead of sometimes.
binlog:
Not sure if that's intended or a bug. When disabling the |
OK, after reading this thread I think there's a bit of misunderstanding about the Deterministic/ContinuousIntegrationBuild properties and the actual impacts they have on the build. Let's work backwards a bit from @stijnherreman's example. The CoreCompile target mentioned above will only rebuild if any of its inputs have changed. What are those inputs? <Target Name="CoreCompile"
Inputs="$(MSBuildAllProjects);
@(Compile);
@(_CoreCompileResourceInputs);
$(ApplicationIcon);
$(KeyOriginatorFile);
@(ReferencePathWithRefAssemblies);
@(CompiledLicenseFile);
@(LinkResource);
@(EmbeddedDocumentation);
$(Win32Resource);
$(Win32Manifest);
@(CustomAdditionalCompileInputs);
$(ResolvedCodeAnalysisRuleSet);
@(AdditionalFiles);
@(EmbeddedFiles);
@(Analyzer);
@(EditorConfigFiles)" ...>
...
</Target> There's a lot of stuff in here, but one thing to note is that all of these are files - MSBuild is a file-based, timestamp-based dependency engine. What this means is that unless any of these inputs directly or indirectly depends on So how do those properties get used in a typical .NET SDK build (as determined by a binlog of a
There may be custom build targets out in the ecosystem that also use these, but that's all that I can see in the SDK's targets. What does this mean?
cc @dsplaisted @rainersigwald for thoughts/analysis. |
We do this already for some, this is a reasonable addition. |
So in summary, we add a CoreCompileCache include for the deterministic build property and add source link as an input to CoreCompile (assuming Jared says yet). This will make some builds more accurate so worth doing in 9 as it seems straightforward. |
Seems reasonable. My only pushback would be do we have plans to add a warning / analyzer for this? The
Is there a reason this couldn't be a core MSBuild primitive? Essentially a simple way for a group of non-file properties to be properly tracked as input to a target? |
I believe this is dotnet/msbuild#701
Added dotnet/msbuild#9741 to track this, it's a great idea. |
It also effects the PDB files (removes absolute path to source files). This also happens if the project doesn't use source link. |
@cremor can you help me find in the props/targets where that linkage is? I didn't see it when I was digging yesterday. |
Sorry, I don't know how the .NET SDK works internally. I only know that it has this effect because that's the reason I use the property. Documentation here: https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#continuousintegrationbuild |
I believe it's the sourcelink.json input to the compiler that causes the compiler to emit different .pdb output |
It's the PathMap parameter of the Csc task, not the SourceLink parameter. |
This is one part of dotnet/sdk#16325, identifying two areas where inputs to the CoreCompile Target (via the Csc/Fsc/etc Tasks) aren't tracked consistently.
I've sent PRs for all of these actions to MSBuild, Roslyn, and FSharp so this should be well on its way to fixed. |
Roslyn PR was here: dotnet/roslyn#72109 going to close this one now that we've addressed this facet of the issue. More broadly we need something like dotnet/msbuild#701 to more granularly check inputs. |
(I hope this is the correct place to raise this question/issue. apologies if it isn't)
Issue
Trying to building a class library on a CI/CD server that is deterministic using the
ContinuousIntegrationBuild=true
property argument on the cli doesn't seem to actually do this?Assumption:
dotnet build
should allow this msbuild propertySteps to repo.
now goto
C:\temp\nuget-testing
and double click on the.nupkg
file that is there. NuGet Package Explorer opens up and this is what it looks like:I'm not sure if this is an issue with NuGet or
dotnet build
CLI or NGPE?Info
The text was updated successfully, but these errors were encountered: