[英]using relative path on .nuget packages folder in .csproj file
How to use relative path on.nuget packages folder in.csproj file.如何在.csproj 文件中使用.nuget 包文件夹上的相对路径。 I've.txt content files and it is copied to my bin directory if I make a build only if I set the property to copy always.我有.txt 内容文件,如果我只在我将属性设置为始终复制时进行构建,它就会被复制到我的 bin 目录中。 By doing that I see a full hardcoded path value (c:\users\usr1234.nuget\packages\packagename\contentfiles\any\newfile.txt) in my.csproj file how to set the relative path in my.csproj file or is there any work around for this?通过这样做,我在 my.csproj 文件中看到了一个完整的硬编码路径值 (c:\users\usr1234.nuget\packages\packagename\contentfiles\any\newfile.txt) 如何在 my.csproj 文件中设置相对路径或者是有什么解决方法吗?
thanks in advance提前致谢
In my case I had to remove some content files from my solution and the output directory.就我而言,我必须从我的解决方案和 output 目录中删除一些内容文件。 I did it by including the following in my .csproj
file:我通过在我的.csproj
文件中包含以下内容来做到这一点:
<ItemGroup>
<None Remove="$(UserProfile)\.nuget\packages\your.package\*\contentFiles\any\somefile.txt" />
</ItemGroup>
$(UserProfile)
corresponds to C:\\users\YourUsername
$(UserProfile)
对应于C:\\users\YourUsername
\*\
is used to be able to exclude files from differnet versions of your nuget package so you don't need to update this line when you update your nuget package to a new version \*\
is used to be able to exclude files from differnet versions of your nuget package so you don't need to update this line when you update your nuget package to a new versionAlso I'm not sure this will work outside Windows另外我不确定这是否适用于 Windows
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.