Skip to content

Improving compatibility with VS2017 and .NETCore projects#12

Merged
kzu merged 3 commits into
masterfrom
master
Aug 17, 2018
Merged

Improving compatibility with VS2017 and .NETCore projects#12
kzu merged 3 commits into
masterfrom
master

Conversation

@kzu

@kzu kzu commented Mar 5, 2017

Copy link
Copy Markdown
Owner

The existing package has a number of problems:

  • Usage of powershell for adding content files: these files
    are no longer executed by nuget (IIRC, as of NuGet v3+)
  • Since they are no longer run, not only does the sample .cs
    does not get injected, but neither does the target run at
    all since it's also the PS1 that did the injection of an
    MSBuild target.

The latter is unnecessary since NuGet already supports providing
targets via nugets. This is added by providing the new InjectModuleInitializer.targets
as part of the nuget package.

WRT to the sample content file, since it adds little value and
it will be tricky to maintain in a compatible way across content vs
contentFiles and packages.config vs project.json/PackageReference in
VS2015+, I think it's simply better to just improve the readme.txt.

After all, it's just a simple class with one method. No big deal copying
it from the readme after installing.

The existing package has a number of problems:
- Usage of powershell for adding content files: these files
  are no longer executed by nuget (IIRC, as of NuGet v3+)
- Since they are no longer run, not only does the sample .cs
  does not get injected, but neither does the target run at
  all since it's also the PS1 that did the injection of an
  MSBuild target.

The latter is unnecessary since NuGet already supports providing
targets via nugets. This is added by providing the new InjectModuleInitializer.targets
as part of the nuget package.

WRT to the sample content file, since it adds little value and
it will be tricky to maintain in a compatible way across content vs
contentFiles and packages.config vs project.json/PackageReference in
VS2015+, I think it's simply better to just improve the readme.txt.

After all, it's just a simple class with one method. No big deal copying
it from the readme after installing.
@einaregilsson

Copy link
Copy Markdown
Contributor

Thanks for the pull request. Will merge it and publish when I can, right now I don't have a Windows machine available, not sure if I will be able to compile this with .NET Core.

@kzu

kzu commented Aug 14, 2018

Copy link
Copy Markdown
Owner Author

Hi there, it's been a while ;)

Remove all the cruft from the old-way, including:

- Make the csproj nicer by using SDK-style
- Use PackageReference for Mono.Cecil instead of checking in libs
- Remove the manually crafted .nuspec and and folder structure and
  let NuGet (SDK) Pack do its work instead
- Include a .props that allows third parties to invoke the tool by
  using $(InjectModuleInitializerTool)
- Update the .targets to make it incremental build friendly, and
  support strong named assemblies too
- Temporarily remove tests from project (this needs to go into
  another project, now that there is a free test runner that can
  be installed in Community (TestDriven.NET).
- Remove the embedded assembly hack for loading Cecil, since this
  is a standalone tool that can simply resolve its own assemblies
  from its local directory under \tools
- Account for minor changes in Cecil that require disposing the
  assembly and reading it in memory up-front.
- Bump version to 2.0.0 since there's quite significant changes,
  including not supporting the old .ps1 anymore.
@kzu

kzu commented Aug 14, 2018

Copy link
Copy Markdown
Owner Author

Will be available as soon as nuget.org indexes it at https://www.nuget.org/packages/InjectModuleInitializer.Unofficial as v2.0.0

@kzu kzu merged commit e3c5337 into kzu:master Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants