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

Any plan on code snippets for MSBuild project file? #28

Closed
doggy8088 opened this issue Jan 18, 2018 · 13 comments
Closed

Any plan on code snippets for MSBuild project file? #28

doggy8088 opened this issue Jan 18, 2018 · 13 comments

Comments

@doggy8088
Copy link
Contributor

Hi,

Do you have any plan on code snippets for MSBuild project file? Any ideas?

@tintoy
Copy link
Owner

tintoy commented Jan 18, 2018

Hi - are there any you'd particularly like to see? I'm open to the idea :)

@doggy8088
Copy link
Contributor Author

@tintoy Yes, I have tons of ideas for this. 😄

  • For ASP.NET Core 2.0 apps, there are some common patterns that are very often to add manually.

    • Metapackage for ASP.NET Core
        <ItemGroup>
          <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
        </ItemGroup>
      
    • dotnet-watch tool
        <ItemGroup>
            <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
        </ItemGroup>
      
    • When deploy ASP.NET Core to IIS, you need to add this one.
      <PropertyGroup>
        <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
      </PropertyGroup>
    
  • For .NET Core & NuGet package

    • There are some properties need to be filled when you need to pack as a NuGet package
        <PropertyGroup>
          <Company>$CompanyName$</Company>
          <Authors>$Author$</Authors>
          <Version>$Version$</Version>
          <Description>$Description$</Description>
          <IncludeSymbols>true</IncludeSymbols>
          <IncludeSource>true</IncludeSource>
          <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
        </PropertyGroup>
      
    • For the multi-targeting framework in .NET Standard project
        <ItemGroup Condition="'$(TargetFramework)' == '$moniker$'">
          <Reference Include="$NuGetPackageName$" />
        </ItemGroup>
      

There are some other frameworks such as Entity Framework Core. There are some tooling support need to change *.csproj manually.

What do you think? 😃

@tintoy
Copy link
Owner

tintoy commented Jan 20, 2018

Those are great ideas!

Would you like to open a PR or would you prefer me to add them? I'm happy to do either 😀

@doggy8088
Copy link
Contributor Author

@tintoy Can I just put my snippets into https://github.com/tintoy/msbuild-project-tools-vscode/blob/master/snippets/msbuild-project.json , then you do the following works?

@tintoy
Copy link
Owner

tintoy commented Jan 20, 2018

Sure that's fine, I can take it from there.

@doggy8088
Copy link
Contributor Author

doggy8088 commented Jan 26, 2018

@tintoy PR #29 have been tested. All works. Please take a look. Thanks. 😄

tintoy added a commit that referenced this issue Jan 26, 2018
- Restrict snippets to MSBuild language (not XML).
- Add note about new snippets to README.
- Update CHANGELOG and CONTRIBUTORS.

#28
@tintoy
Copy link
Owner

tintoy commented Jan 26, 2018

@doggy8088 - it's good to go:

https://github.com/tintoy/msbuild-project-tools-vscode/releases/tag/v0.2.21

Thanks again for your contribution! Feel free to add any other snippets you come up with 😉

@tintoy tintoy closed this as completed Jan 26, 2018
@doggy8088
Copy link
Contributor Author

@tintoy I installed this version. The code snippets looks not working. Do you know why?

image

@tintoy
Copy link
Owner

tintoy commented Jan 27, 2018

Have you changed the language to MSBuild?

@tintoy
Copy link
Owner

tintoy commented Jan 27, 2018

Here's what I see:

image

@doggy8088
Copy link
Contributor Author

I opened my *.csproj file, the default language mode is "XML". After I switch language mode to MSBuild.
Everything is OK. But why my default is XML? What else I need to configure?

@doggy8088
Copy link
Contributor Author

After I set the "files.associations" in my user settings. The default language mode has been changed to msbuild now. Problem solved. 👍

    "files.associations": {
        "*.csproj": "msbuild"
    }

@tintoy
Copy link
Owner

tintoy commented Jan 27, 2018

Yeah - the readme shows how to do that, but I was nervous about automatically taking over people's file associations :)

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

2 participants