Files from nuget package not copied to the build output #474
-
Hi, I have a probably quick question. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Can you manually add them to the project and set the build action? |
Beta Was this translation helpful? Give feedback.
-
There is a way that you can do this without needing to manually copy files from the NuGet package. On the <PackageReference Include="EmmetNetSharp" Version="1.0.0" GeneratePathProperty="true"/> In this instance, the property will be called You can then use that property to include the files from the NuGet package. For example, if you want to include the files in the VSIX file, you can do this: <ItemGroup>
<Content Include="$(PkgEmmetNetSharp)\content\Scripts\*.js" IncludeInVsix="true" VsixSubPath="Scripts" />
</ItemGroup> In the VSIX (viewed using 7zip): If you don't want the files to be visible in Solution Explorer, you can hide them using the <ItemGroup>
<Content Include="$(PkgEmmetNetSharp)\content\Scripts\*.js" IncludeInVsix="true" VsixSubPath="Scripts" Visible="false" />
</ItemGroup> Or you can put them in a virtual folder: <ItemGroup>
<Content Include="$(PkgEmmetNetSharp)\content\Scripts\*.js" IncludeInVsix="true" VsixSubPath="Scripts">
<Link>Scripts\%(Filename)%(Extension)</Link>
</Content>
</ItemGroup> |
Beta Was this translation helpful? Give feedback.
There is a way that you can do this without needing to manually copy files from the NuGet package.
On the
PackageReference
element, you can setGeneratePathProperty
to true. That will create a property with the path to the NuGet package.In this instance, the property will be called
PkgEmmetNetSharp
(you can look in theobj/*.nuget.g.props
file to confirm the name).You can then use that property to include the files from the NuGet package. For example, if you want to include the files in the VSIX file, you can do this: