{"id":19744470,"url":"https://github.com/microsoft/msbuildforunity","last_synced_at":"2025-04-05T16:06:28.992Z","repository":{"id":35837696,"uuid":"199713509","full_name":"microsoft/MSBuildForUnity","owner":"microsoft","description":"MSBuild integration in Unity","archived":false,"fork":false,"pushed_at":"2023-10-31T15:29:18.000Z","size":2958,"stargazers_count":353,"open_issues_count":51,"forks_count":32,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-05T16:06:17.365Z","etag":null,"topics":["msbuild","unity"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-07-30T19:20:02.000Z","updated_at":"2025-03-31T14:08:03.000Z","dependencies_parsed_at":"2024-01-14T17:04:22.343Z","dependency_job_id":"53885ebb-5ce5-4691-8898-759e34e6a1a0","html_url":"https://github.com/microsoft/MSBuildForUnity","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FMSBuildForUnity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FMSBuildForUnity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FMSBuildForUnity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FMSBuildForUnity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/MSBuildForUnity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361686,"owners_count":20926643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["msbuild","unity"],"created_at":"2024-11-12T02:00:36.738Z","updated_at":"2025-04-05T16:06:28.971Z","avatar_url":"https://github.com/microsoft.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MSBuildForUnity\n\nMSBuildForUnity solves the problem of establishing clear dependency relationships between Unity project and other .NET components such as external (to Unity) C# projects, or NuGet packages. It creates a familiar to .NET developers project structure and ensures that the dependencies are resolved and brought into the Unity project as appropriate. With this component, you can:\n\n- Share code between Unity and other .NET projects (such as UWP XAML apps, Xamarin apps, etc.).\n- Consuming existing .NET components (e.g. NuGet packages).\n\nThe samples included in this repository best convey the simplicity and value of this component:\n\n- [Simple NuGet Dependency Sample](Samples/SimpleNuGetDependency.Unity/README.md) - Showcases the simplest and most minimal usage of this component to pull in a dependency.\n- [Integrated Dependencies Sample](Samples/IntegratedDependencies.Unity/README.md) - Showcases the power of this component by relying on project generation.\n- [Cross Unity Dependencies Sample](Samples/CrossUnityDependencies.Unity/README.md) - Showcases how to establish a dependency between two Unity projects (almost like AsmDef-to-AsmDef).\n\n### Builds and Packages\n\n| Build | Build Status                                         | Package Feed                                                                                                          |\n|-------|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|\n| UPM   | [![UPM Build Status][UPMBuildBadge]][UPMBuild]       | [Azure DevOps][UPMPackage]                                                                                            |\n| NuGet | [![NuGet Build Status][NuGetBuildBadge]][NuGetBuild] | [![NuGet Package][NuGetPackageBadge]][NuGetPackage]                                                                   |\n\n## Quick Start\n\nThe following are basic instructions for taking advantage of MSBuildForUnity for some common scenarios.\n\n### Bring NuGet packages and MSBuild projects into a Unity project\n\nThis scenario leverages the MSBuildForUnity [Project Builder](#msbuild-project-builder) and the MSBuildForUnity [NuGet Package](#msbuildforunity-nuget-package).\n\n1. Add the `com.microsoft.msbuildforunity` UPM (Unity Package Manager) package.\n    - Edit the `Packages/manifest.json` file in your Unity project.\n    - Add the following near the top of the file:\n\n        ```json\n        \"scopedRegistries\": [\n            {\n                \"name\": \"Microsoft\",\n                \"url\": \"https://pkgs.dev.azure.com/UnityDeveloperTools/MSBuildForUnity/_packaging/UnityDeveloperTools/npm/registry/\",\n                \"scopes\": [\n                    \"com.microsoft\"\n                ]\n            }\n        ],\n        ```\n\n    - Add the following to the `dependencies` section of the file:\n\n        ```json\n          \"com.microsoft.msbuildforunity\": \"\u003cversion\u003e\"\n        ```\n      NOTE: Replace `\u003cversion\u003e` with the latest package version from the [MSBuildForUnity UPM feed][UPMPackage].\n\n1. MSBuildForUnity will create a top-level project in your `Assets` folder named after your Unity project name: `{UnityProjectName}.Dependencies.msb4u.csproj`, edit this project file to add additional references to any NuGet packages or C# projects you want to use in your Unity project.\n\n    ```xml\n    \u003cProject ToolsVersion=\"15.0\"\u003e\n    \u003c!--GENERATED FILE--\u003e\n    \u003c!--\n        This file can be modified and checked in.\n        \n        It is different from the other generated C# Projects in that it will be the one gathering all dependencies and placing them into the Unity asset folder.\n        \n        You can add project level dependencies to this file, by placing them below:\n        - \u003cImport Project=\"$(MSBuildForUnityGeneratedProjectDirectory)\\$(MSBuildProjectName).g.props\" /\u003e\n        and before:\n        - \u003cImport Project=\"$(MSBuildForUnityGeneratedProjectDirectory)\\$(MSBuildProjectName).g.targets\" /\u003e\n        \n        Do not add any source or compilation items.\n        \n        Examples of how you can modify this file:\n        - Add NuGet package references:\n            \u003cItemGroup\u003e\n                \u003cPackageReference Include=\"Newtonsoft.Json\" Version=\"11.0.1\" /\u003e\n            \u003c/ItemGroup\u003e\n        - Add external C# project references:\n        \u003cItemGroup\u003e\n            \u003cProjectReference Include=\"..\\..\\..\\ExternalLib\\ExternalLib.csproj\" /\u003e\n        \u003c/ItemGroup\u003e\n    --\u003e\n\n    \u003cImport Project=\"$([MSBuild]::GetPathOfFileAbove(MSBuildForUnity.Common.props))\" Condition=\"Exists('$([MSBuild]::GetPathOfFileAbove(MSBuildForUnity.Common.props))')\" /\u003e\n\n    \u003cPropertyGroup\u003e\n        \u003cTargetFramework\u003e$(UnityCurrentTargetFramework)\u003c/TargetFramework\u003e\n    \u003c/PropertyGroup\u003e\n\n    \u003c!-- SDK.props is imported inside this props file --\u003e\n    \u003cImport Project=\"$(MSBuildForUnityGeneratedProjectDirectory)\\$(MSBuildProjectName).g.props\" /\u003e\n\n    \u003cItemGroup\u003e\n        \u003c!--Add NuGet or Project references here--\u003e\n    \u003c/ItemGroup\u003e\n\n    \u003c!-- SDK.targets is imported inside this props file --\u003e\n    \u003cImport Project=\"$(MSBuildForUnityGeneratedProjectDirectory)\\$(MSBuildProjectName).g.targets\" /\u003e\n    \u003c/Project\u003e\n    ```\n\n1. For additional instructions, see [Core Scenarios](Documentation/CoreScenarios.md).\n\n## Extended Instructions\n\nHere you can find additional instructions for various things you may want to accomplish:\n\n- [Add Support MSB4U to a NuGet Package](Documentation/CraftingNuGetPackages.md)\n- [OSX and Linux Support](Documentation/OSXAndLinuxSupport.md)\n\n## Features\n\nMSBuildForUnity has several features that can be used independently or in conjunction.\n\n### MSBuild Project Builder\n\nThe MSBuild Project Builder provides a means of building MSBuild projects from within Unity, where the output is generally consumed by the Unity project.\n\n[![MSBuild Project Builder Progress Bar](Documentation/MSBuildProjectBuilder/MSBuildProgressBar.gif)](Documentation/MSBuildProjectBuilder/MSBuildProjectBuilder.md)\n\nFor details, see the [documentation](Documentation/MSBuildProjectBuilder/MSBuildProjectBuilder.md), [source](Source/MSBuildTools.Unity/Packages/com.microsoft.msbuildforunity/Editor/ProjectBuilder/MSBuildProjectBuilder.cs), and [samples](Source/MSBuildTools.Unity/Assets/Samples/Samples.sln).\n\n### MSBuild Project Generator\n\nThe MSBuild Project Generator will generate a Visual Studio solution configured for building the Unity project into DLLs outside of Unity. This solution is configured for each of the platforms installed with Unity and the InEditor/Player variants of the assemblies.\n\n### MSBuildForUnity NuGet Package\n\nThe `MSBuildForUnity` NuGet package augments the default MSBuild build logic to ensure the build output is suitable for Unity consumption. This package can be referenced from MSBuild projects that are built by the [MSBuild Project Builder](#msbuild-project-builder) to add these features:\n\n- Meta file generation - generates .meta files for build output such as .dlls.\n- Dependency resolution - all dependencies (through `PackageReference`s or `ProjectReference`s) are resolved and sent to the output directory (which is typically under the Unity project's Assets directory).\n- Debug symbol patching - enables debugging pre-built dlls (e.g. from NuGet packages) while running in the Unity Editor.\n\nFor details, see the [documentation](Documentation/MSBuildForUnityNuGetPackage/MSBuildForUnityNuGetPackage.md), [source](Source/MSBuildTools.Unity.NuGet/MSBuildForUnity.csproj), and [samples](Source/MSBuildTools.Unity/Assets/Samples/Samples.sln).\n\n[PRBuildBadge]: https://dev.azure.com/UnityDeveloperTools/MSBuildForUnity/_apis/build/status/MSBuildForUnity.PRGate?branchName=master\n[PRBuild]: https://dev.azure.com/UnityDeveloperTools/MSBuildForUnity/_build/latest?definitionId=2\u0026branchName=master\n\n[UPMBuildBadge]: https://dev.azure.com/UnityDeveloperTools/MSBuildForUnity/_apis/build/status/MSBuildForUnity.Publish.UPM?branchName=master\n[UPMBuild]: https://dev.azure.com/UnityDeveloperTools/MSBuildForUnity/_build/latest?definitionId=1\u0026branchName=master\n\n[NuGetBuildBadge]: https://dev.azure.com/UnityDeveloperTools/MSBuildForUnity/_apis/build/status/MSBuildForUnity.Publish.NuGet?branchName=master\n[NuGetBuild]: https://dev.azure.com/UnityDeveloperTools/MSBuildForUnity/_build/latest?definitionId=3\u0026branchName=master\n\n[UPMPackage]: https://dev.azure.com/UnityDeveloperTools/MSBuildForUnity/_packaging?_a=package\u0026feed=UnityDeveloperTools\u0026view=versions\u0026package=com.microsoft.msbuildforunity\u0026protocolType=Npm\n\n[NuGetPackageBadge]: https://feeds.dev.azure.com/UnityDeveloperTools/0cb95e25-9194-4ccd-9afb-439b25ecb93a/_apis/public/Packaging/Feeds/a3d1c3cc-6042-4e05-b699-39a947e75639/Packages/bdf78d31-dd97-4f6b-befb-75bb6185172e/Badge\n[NuGetPackage]: https://dev.azure.com/UnityDeveloperTools/MSBuildForUnity/_packaging?_a=package\u0026feed=a3d1c3cc-6042-4e05-b699-39a947e75639\u0026package=bdf78d31-dd97-4f6b-befb-75bb6185172e\u0026preferRelease=true\n\n## Contributing\n\nThis project welcomes contributions and suggestions.  Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit \u003chttps://cla.opensource.microsoft.com\u003e.\n\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n### Prerequisites\n\nThe following tools are required to contribute to this project:\n\n- [Visual Studio 2017+](https://visualstudio.microsoft.com/downloads)\n- [Unity 2018+](https://unity3d.com/get-unity/download)\n\nTo get started, clone the repo, and then run `git submodule update --init` to initialize submodules.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fmsbuildforunity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2Fmsbuildforunity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fmsbuildforunity/lists"}