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

Does the VSCode tasks still work? #36

Closed
mwkcoding opened this issue Jul 26, 2024 · 19 comments
Closed

Does the VSCode tasks still work? #36

mwkcoding opened this issue Jul 26, 2024 · 19 comments

Comments

@mwkcoding
Copy link

Installed product versions

  • Visual Studio: 2022 Professional
  • This extension: 2.9.9

Description

I'd like to use the Visual Studio Code tasks as defined in the wiki. However, it seems to be requiring .NET Core 2.0 Runtime which is way past EOL and not cross-platform. Can this be upgraded? Our use-case is that front-end developers would like to not have to open Visual Studio to bundle our JS files and I'm working towards fixing that. It'd be nice if we can keep using this extension as it would be the least invasive DX improvement.

Steps to recreate

  1. Follow guide to make VSCode task for bundling.
  2. Run task
  3. See error

Current behavior

Currently the task fails with the following output:
image

Expected behavior

The task should run without issues and not require Visual Studio to be present or open.

@failwyn
Copy link
Owner

failwyn commented Jul 29, 2024

It looks like the error is saying that you need to install .net core 2.0

@mwkcoding
Copy link
Author

Sure. But as mentioned we can't use .NET Core 2.0. All projects in our solution is running .NET 6.
Either way, it's the original author's package. Have you made a more up-to-date version of it and published?

@bakerhillpins
Copy link

bakerhillpins commented Jul 30, 2024

@mwkcoding Am I misunderstanding something here, it seems you're using a different package?

image

Regardless, a PR for this here should be relatively simple too as it should compile just fine with .NET6/8.

@mwkcoding
Copy link
Author

mwkcoding commented Jul 30, 2024

@bakerhillpins I'm using the package linked in the wiki that is being linked to from this repo. I'm aware that the wiki being linked to is the one made by the original author. If there's a different package I should use, I'd like to know which one that would be. I also mentioned that I am aware that it's the original authors package I'm using in my last comment.

@failwyn
Copy link
Owner

failwyn commented Jul 30, 2024

It's the correct package, I never use the Task Runner, so I'm not too familiar with the code, but it looks like the issue is from the BundlerMinifier\src\BundlerMinifier\build\BuildBundlerMinifier2022.targets file; it uses the netstandard2.0 build when running in .net core; I just merged a PR from another user that adds net6.0 and net8.0 to the project, so I could take a look and see if I can modify it to use those builds for the tasks. I can try to get it into the next release if you don't mind helping to test the functionality before I release it' I'm going away in 20 days and would hate to leave the community with no support on a new version in case I miss anything in testing.

@bakerhillpins
Copy link

bakerhillpins commented Jul 30, 2024

@failwyn

It's the correct package,

Ok, I'll take your word for it but it's clearly throwing an error from a different NuGet package based upon the directory listed in the error: .nuget\packages\bundlerminifier.core\2.9.406. (which is also out of date)
https://www.nuget.org/stats/packages/BundlerMinifier.Core?groupby=Version

This repository doesn't even publish that package as far as I can tell, that's published by the original author's repository. This repo simply builds the .Core code directly into the dll used.
Also, I don't have that BundlerMinifier.Core package installed anywhere that I can find on my system and this fork and Vsix package works just fine.

@mwkcoding
The original package is a standalone entity that produces it's own NuGet packages. My understanding is that this fork is simply making it work in VS2022

@bakerhillpins I'm using the package linked in the wiki that is being linked to from this repo. I'm aware that the wiki being linked to is the one made by the original author. If there's a different package I should use, I'd like to know which one that would be. I also mentioned that I am aware that it's the original authors package I'm using in my last comment.

When this package is published you could try installing it as a dotnet tool. #35

@failwyn
Copy link
Owner

failwyn commented Jul 30, 2024

This is the library that I publish to nuget when I release new versions of the vsix https://www.nuget.org/packages/BuildBundlerMinifier2022 I could look into publishing BundlerMinifier.Core to nuget in the future, but I would probably have to rename it to do upload it; I'll have to see how much refactoring and testing that would require.

@mwkcoding
Copy link
Author

It would be the core one I'd need. That's the CLI tool that allows it to be used in vscode tasks. According to the original author.

@failwyn
Copy link
Owner

failwyn commented Jul 30, 2024

@mwkcoding Would @bakerhillpins suggestion work for you in the short term if I can get the release out this week?

@bakerhillpins You're right, I wasn't aware of BundlerMinifier.Core being a nuget package; I'll look into adding that to a future release.

@mwkcoding
Copy link
Author

mwkcoding commented Jul 31, 2024

@failwyn Since we're getting close to a deadline, I ended up having to make another solution. I wrote Gulp tasks to replace the extension. However, I'm up for helping getting this to work for others.

@failwyn
Copy link
Owner

failwyn commented Jul 31, 2024

Sorry I couldn't get it fixed for you sooner, it's tough to find time with the kids home and traveling.

@mwkcoding
Copy link
Author

That's completely understandable. Family time is important 🙏

@failwyn
Copy link
Owner

failwyn commented Aug 6, 2024

This should work in the latest release.

@mwkcoding
Copy link
Author

I tried installing this as a dotnet tool. It does not seem to work. I think we'll need the core package published.

@bakerhillpins
Copy link

bakerhillpins commented Aug 7, 2024

I tried installing this as a dotnet tool. It does not seem to work. I think we'll need the core package published.

I just installed and ran it. Works fine for me. What errors are you receiving?
image

@mwkcoding
Copy link
Author

@bakerhillpins Oh. I tried adding it to .csproj like so:

<ItemGroup>
    <DotNetCliToolReference Include="BuildBundlerMinifier2022" Version="2.9.11" />
</ItemGroup>

But adding it like dotnet tool install BuildBundlerMinifier2022 then it works!

@bakerhillpins
Copy link

bakerhillpins commented Aug 7, 2024

@bakerhillpins Oh. I tried adding it to .csproj like so:

<ItemGroup>
    <DotNetCliToolReference Include="BuildBundlerMinifier2022" Version="2.9.11" />
</ItemGroup>

But adding it like dotnet tool install BuildBundlerMinifier2022 then it works!

Hrm.. have not seen that way to add a dotnet tool.

You shouldn't need to manually add a reference to your project either. If you right click on the bundleconfig.json file and select Enable Bundle On Build that will add the project reference to your project and it will then build within VS.

@bakerhillpins
Copy link

bakerhillpins commented Aug 7, 2024

@mwkcoding Is your project properly setup for package reference or package config operation? I think <DotNetCliToolReference /> only works in .NET SDK projects using package references

Ah, that's why I don't recognize it, that feature was deprecated a long time ago. dotnet/sdk#3115

https://stackoverflow.com/a/44173152

@mwkcoding
Copy link
Author

mwkcoding commented Aug 8, 2024

I suppose our setup has been a bit wonky since the project was migrated from .NET Framework to .NET. Either way. It works by running the command! I'll close the issue.

Thanks for the help @failwyn @bakerhillpins

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

No branches or pull requests

3 participants