brandedoutcast / publish-nuget

📦 GitHub action to automate publishing NuGet packages when project version changes
https://github.com/marketplace/actions/publish-nuget
MIT License
197 stars 101 forks source link

[Feature] .Net Framework support #25

Open KuraiAndras opened 4 years ago

KuraiAndras commented 4 years ago

Can you add an options to use this action with msbuild and nuget.exe to publish framework packages? Some projects ( for example Uwp) need msbuild.

brandedoutcast commented 4 years ago

I want to keep it as dotnet-core only as .NET 5 will hopefully make it possible to do everything with dotnet-cli but I understand the need here & let me see what can be done

KuraiAndras commented 4 years ago

I tought abount creating a fork of this repo to run on windows and use MSBuild and nuget.exe, but i'm not too familiar about setting up reusable actions.

Changing the required host to windows. and substituting dotnet with MsBuild.exe and nuget.exe in index.js should do the trick.

Would you consider creating a fork of this with these changes?

brandedoutcast commented 4 years ago

Nah windows / linux is decided by your pipeline this action has nothing to do with it

A simpler approach would be to create a flag that can be set to use MSBuild instead of the default dotnet-core

AraHaan commented 4 years ago

Actually there is a way to build the net framework targets on linux and mac as well, so this should not be an issue all you need is to add this line to your sdk style csproj:

<PackageReference Condition="!$(TargetFramework.StartsWith('netcoreapp')) AND !$(TargetFramework.StartsWith('netstandard'))" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0">
  <PrivateAssets>All</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

In my csproj I even inlined it all to 1 xml line too: https://github.com/Elskom/zlib.managed/blob/master/zlib.managed.csproj#L70

This is because I have dependabot manage the updates to the nuget packages for me.

KuraiAndras commented 4 years ago

@AraHaan I have tried this with a UWP project but it did not work. I tried this with both dotnet build and dotnet msbuild but it fails with

error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.1.201\Microsoft\WindowsXaml\v16.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found.

I suppose UWP is only supported on windows. The nuget you provided only contains .Net Framework assemblies, and thus it cannot have all the necessary targets for UWP.

AraHaan commented 4 years ago

Welp I guess time to file an issue for that package then to request them to provide the targets for UWP.

sinathr commented 4 years ago

How can I get the package built via msbuild.exe ?

m-sadegh-sh commented 2 years ago

@brandedoutcast Any update on the msbuild support? I can create a PR for this. I just need to get an update before doing that.