开发者

Copy Files to Project Folder with Visual Studio Project Template

开发者 https://www.devze.com 2023-03-20 13:08 出处:网络
I\'m making a custom Visual Studio Project Template for a CSharp project and was wondering if there was a way to copy a dll from the template zip file to the new project file wi开发者_StackOverflow社区

I'm making a custom Visual Studio Project Template for a CSharp project and was wondering if there was a way to copy a dll from the template zip file to the new project file wi开发者_StackOverflow社区thout including the dll in the project files?

The idea is that the project references the dll, but I just dont want the developers to care about the assembly.


What I did was, created new template wizard i.e. by implementing IWizard interface. This article(http://msdn.microsoft.com/en-us/magazine/cc188697.aspx) will help you to get started with custom wizard.

Then in the RunStarted() method you will be able to get path to the current template like this

    Path.GetDirectoryName((string)customParams[0])

Also you can get the path where the project is created using below code

    replacementsDictionary["$destinationdirectory$"]

Once you have these values, do a normal file copy on the RunFinished() method

0

精彩评论

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

关注公众号