Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


CsprojModifier improves the developer experience in Visual Studio and Rider by performing additional processing when Unity Editor generates .csproj.


CsprojModifier provides following features:

  • Insert additional projects as Import elements into generated .csproj
  • Add analyzer references to generated .csproj
    • Disabled if you are using Rider or Visual Studio Code with Unity 2020.2 or later

Table of Contents

Works with

  • Unity Editor 2019.4 (LTS) or later
  • Visual Studio 2019 or Rider


Add the package via git from Package Manager.

If you are using Unity 2019.1 or later, you can use Package Manager to install a package via git.


Insert additional projects as Import elements into generated .csproj

Add references to additional project files (.props or .targets) to the generated .csproj using Import element. This enables you to add files to the project, add references, and so on.

Note: .csproj is only used in IDEs such as Visual Studio and Rider, and does not affect the actual compile time by Unity Editor.


For example, you can create the following file YourAwesomeApp.DesignTime.props and import it to use BannedApiAnalyzer.

<Project xmlns="">
    <Analyzer Include="Assets/Plugins/Editor/Analyzers/Microsoft.CodeAnalysis.BannedApiAnalyzers.dll" />
    <Analyzer Include="Assets/Plugins/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.BannedApiAnalyzers.dll" />
    <AdditionalFiles Include="$(ProjectDir)\BannedSymbols.txt" />

BannedApiAnalyzer expects BannedSymbols.txt as AdditionalFiles to be included in the project, so adding it this way will work.

Inject the contents of additional project files (.props, .targets) directly instead of importing them

If you specify an insert position Append Content or Prepend Content as the insertion position, CsProjModifier will read the XML file and inject the elements directly into .csproj.

<!-- * Example: `Prepend: MyApp.Unity.props` -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="">
  <Import Project="MyApp.Unity.props" />

  <!-- .csproj content generated by Unity Editor -->
  <!-- ... -->

<!-- * Example: `Prepend Content: MyApp.Unity.props` -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="">
    <!-- ... -->
    <!-- ... -->
    <!-- ... -->

  <!-- .csproj content generated by Unity Editor -->
  <!-- ... -->

Add analyzer references to generated .csproj

NOTE: Disabled this feature if you are using Rider or Visual Studio Code with Unity 2020.2 or later. Unity Editor has Roslyn Analyzer IDE support.

Roslyn analyzers are supported in Unity 2020.2 or later. However, currently, Roslyn analyzers are not included in .csproj, and those are only used at compile time.

The extension will insert Analzyer element into .csproj when generating the project file. As a result, you can run Roslyn Analyzer when editing code in Visual Studio. (of course, you can use it before 2020.2!)

How to use

Add Roslyn Analyzer to your project in the same way that it is supported in 2020.2.

  • Add the Roslyn analyzer libraries
  • Uncheck all target platforms in the Plugin inspector
  • Add Asset Label RoslynAnalyzer to the libraries


MIT License


CsprojModifier performs additional processing when Unity Editor generates the .csproj.







No packages published

Contributors 4