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

Pack always builds a project with reference assemblies #136

Open
bgavrilMS opened this issue Dec 5, 2018 · 4 comments
Open

Pack always builds a project with reference assemblies #136

bgavrilMS opened this issue Dec 5, 2018 · 4 comments
Labels

Comments

@bgavrilMS
Copy link

  1. Add a reference assembly to a project, like described in the blog (e.g. https://github.com/AzureAD/microsoft-authentication-library-for-dotnet)

  2. Build the sln, which builds both project and ref project

  3. Pack via "msbuild /t:pack /p:nobuild=true"

Actual:
The pack does not obey the "nobuild" setting. It needs to rebuild because the ref assemblies are not actually produced in step 2

Expected:
Pack should not rebuild

Impact:
Because pack rebuilds, some DLLs are overwritten. This makes DLL signing difficult. Ideally all DLLs should be on disk and /t:pack just packs

Workaround:
I can workaround by packing twice. So my release pipeline looks like this:

  • build
  • pack
  • sign lib assemblies
  • sign ref assemblies
  • pack /nobuild
@clairernovotny
Copy link
Collaborator

I'll look into this when I can, but in general, I would not suggest making sign as part of the build step. I'd have build/pack do just that, then send the nuget to the signing mechanism once built (you can always extract/repack the nuget with zip before the nuget itself is signed).

@erikpowa
Copy link

Having similar problem here.
Can't run a Target\Task from a .targets inherited from a PackageReference before GenerateNuspec like this

<Target Name="ForceCall" BeforeTargets="GenerateNuspec">
    <CallTarget Targets="TheTask" />
</Target>

I guess the .targets isn't available at that point. (It's working fine if I hook it during build, like AfterTargets="CoreCompile" + working if the .targets is part of the project)

@GeertvanHorrik
Copy link
Contributor

This is why I used dotnet pack instead (it respects the nobuild). I did test this last week, and the problem seems solved?

The scripts I use are here:

https://github.com/GeertvanHorrik/RepositoryTemplate/blob/master/replace/deployment/cake/components-tasks.cake#L218

Will investigate to make sure that references are not being rebuild.

@GeertvanHorrik
Copy link
Contributor

I am using the preview versions of VS, but msbuild with nobuild & pack no longer seems to build reference assemblies (and thus overriding the signed assemblies).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants