开发者

Post build copy config file to another project

I have a solution which contains a website and various class libraries. The exists on the file system like so:

C:\Projects \My开发者_Python百科Website\dev\MyWebsite.sln  
C:\Projects\Core\MyClassLibrary1.csproj  
C:\Projects\Core\MyClassLibrary2.csproj

I want to move the App.config file from MyClassLibrary1 project to the bin of the MyClassLibrary2. I want to do this on post build in VS or MSBuild using relative paths if possible. This way anybody checking out the projects will not have to modify any paths if they choose to locate the project in a different location.

I have already tried the following approaches but to no avail.

copy /Y "$(ProjectDir)App.config"  
$(ProjectDir)\..\ MyClassLibrary2\$(OutDir)\ MyClassLibrary2.dll.config"

Any ideas?

Thanks


Consider adding the App.config file in your second class library using Visual Studio Add As Link.

Add -> Existing Item -> Add As Link

The Add As Link command is shown if you click the dropdown next to regular Add button in Visual Studio. This way you can reuse the file in multiple projects.


Try some other common MSBuild properties, although João has a better suggestion I think.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜