Click here to Skip to main content
15,896,063 members
Home / Discussions / C#
   

C#

 
GeneralRe: SQL Server and C# Pin
john john mackey1-Dec-11 11:01
john john mackey1-Dec-11 11:01 
AnswerRe: SQL Server and C# Pin
BobJanova1-Dec-11 1:46
BobJanova1-Dec-11 1:46 
GeneralRe: SQL Server and C# Pin
john john mackey1-Dec-11 11:23
john john mackey1-Dec-11 11:23 
AnswerRe: SQL Server and C# Pin
jschell1-Dec-11 13:50
jschell1-Dec-11 13:50 
QuestionC# desktop controls Pin
classy_dog30-Nov-11 6:19
classy_dog30-Nov-11 6:19 
AnswerRe: C# desktop controls Pin
fjdiewornncalwe30-Nov-11 8:39
professionalfjdiewornncalwe30-Nov-11 8:39 
AnswerRe: C# desktop controls Pin
BillWoodruff30-Nov-11 14:22
professionalBillWoodruff30-Nov-11 14:22 
QuestionHow do I make Post Publish Tasks work? DLL is locked? Pin
KevonHoughton30-Nov-11 5:37
KevonHoughton30-Nov-11 5:37 
According to the article here:

http://msdn.microsoft.com/en-us/library/t9883dzc.aspx

it is possible to add tasks to a post build event.

I have created a solution with two projects. One for the Test dll and one for a Windows Form application. I have modified the windows form application project file as described in the article above as follows

XML
<UsingTask TaskName="MyTasks.SimpleTask3" AssemblyFile="bin\debug\MyTasks.dll" />
<Target Name="AfterBuild">
  <SimpleTask3 MyProperty="Hello!" />
</Target>


and created a task like this.

C#
using System;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System.Resources;

namespace MyTasks
{
    public class SimpleTask3 : Task
    {
        private string myProperty;

        [Required]
        public string MyProperty
        {
            get { myProperty; }
            set { myProperty = value; }
        }

        public override bool Execute()
        {
            //Change to false to make build fail
            return true;
        }
    }
}


If I build the task project with return true, then build the Windows Form project, the build succeeds. If I then rebuild the task, then attempt to rebuild the Windows Form project, I get the following error:

Error	1	The command "copy "C:\MyTasks\bin\Debug\MyTasks.dll" "C:\TestApplication\bin\Debug\"" exited with code 1.	TestApplication


The only way to get the build to succeed again is to close the solution and re-build. Is this expected behavior? Is there some way to get around this? Having to close and re-open the solution every time the task is changed is annoying.

EDIT:
After some research, trying xcopy, etc... I found that the error has to do with the fact that the MyTask.dll is "in use". Is there a way to force Visual Studio to release the lock on this? This isn't a problem on other projects where there are project references to a dll wit "Copy Local" turned on...

modified 30-Nov-11 12:05pm.

Questionrun sql script in C# Pin
jojoba201130-Nov-11 0:09
jojoba201130-Nov-11 0:09 
AnswerRe: run sql script in C# Pin
Pete O'Hanlon30-Nov-11 0:17
mvePete O'Hanlon30-Nov-11 0:17 
QuestionRe: run sql script in C# <code>new</code> Pin
jojoba201130-Nov-11 0:22
jojoba201130-Nov-11 0:22 
AnswerRe: run sql script in C# new Pin
Pete O'Hanlon30-Nov-11 0:38
mvePete O'Hanlon30-Nov-11 0:38 
QuestionRe: run sql script in C# new Pin
jojoba201130-Nov-11 0:47
jojoba201130-Nov-11 0:47 
AnswerRe: run sql script in C# new Pin
Pete O'Hanlon30-Nov-11 0:56
mvePete O'Hanlon30-Nov-11 0:56 
QuestionRe: run sql script in C# new Pin
jojoba201130-Nov-11 0:58
jojoba201130-Nov-11 0:58 
AnswerRe: run sql script in C# new Pin
Pete O'Hanlon30-Nov-11 1:00
mvePete O'Hanlon30-Nov-11 1:00 
QuestionRe: run sql script in C# new Pin
jojoba201130-Nov-11 1:02
jojoba201130-Nov-11 1:02 
AnswerRe: run sql script in C# new PinPopular
Pete O'Hanlon30-Nov-11 1:07
mvePete O'Hanlon30-Nov-11 1:07 
GeneralRe: run sql script in C# new Pin
jojoba201130-Nov-11 1:09
jojoba201130-Nov-11 1:09 
GeneralRe: run sql script in C# new Pin
Pete O'Hanlon30-Nov-11 1:14
mvePete O'Hanlon30-Nov-11 1:14 
QuestionRe: run sql script in C# new Pin
jojoba201130-Nov-11 17:54
jojoba201130-Nov-11 17:54 
AnswerRe: run sql script in C# new Pin
Dave Kreskowiak1-Dec-11 4:11
mveDave Kreskowiak1-Dec-11 4:11 
AnswerRe: run sql script in C# Pin
jschell30-Nov-11 10:16
jschell30-Nov-11 10:16 
QuestionMicrosoft Interop Word Winforms issue on CITRIX Pin
spankyleo12330-Nov-11 0:00
spankyleo12330-Nov-11 0:00 
AnswerRe: Microsoft Interop Word Winforms issue on CITRIX Pin
Richard MacCutchan30-Nov-11 3:11
mveRichard MacCutchan30-Nov-11 3:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.