Because of ClickOnce, I need to change the assembly name of our WPF application for each environment/configuration used.
The configs are:
- Debug
- Testing
- Release
So, to be able to publish the 3 environments to ClickOnce and to have all of them installed in one machine without one overriding the other, we need to have a different assembly name for the main project of our solution for all three environments. The assemblies would be named like this:
- MyApp.Client.Debug
- MyApp.Client.Testing
- MyApp.Client
Thanks to this StackOverflow answer , I managed to do it, and it works great. The code for MyApp.Client.csproj is this:
<PropertyGroup>
...
<AssemblyName>MyApp.Client</AssemblyName>
...
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AssemblyName>MyApp.Client.Debug</AssemblyName>
...
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Testing|AnyCPU' ">
<AssemblyName>MyApp.Client.Testing</AssemblyName>
...
</PropertyGroup>
I can publish it to my different environments and it goes well, and I can execute my application and work with it. But I can't debug it within Visual Studio, it seems that the IDE seeks "MyApp.Client" as the application entry point and throws something like this:
Visual Studio cannot start debugging because the debug target 'D:\Code\MySolution\MyApp\bin\Testing\MyApp.Client.exe' is missing. Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to point at the correct location for the target assembly.
Being on Testing, it should search for MyApp.Client.Testing.exe, but that doesn't happen. I have been googling for some time about this error, but I haven't been able to find a solution. All references that I find talk about changed OutputPath and things like that, but I think that's not the problem, since the OutputPath is OK, the problem is the executable name.
Any help would be appreciated. Thanks.